<?php

namespace Modules\Package\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Feature\Enums\FeatureTypeEnum;
use Modules\Feature\Models\Feature;

class Package extends Model
{
    //use soft delete
    use SoftDeletes;

    protected $fillable =
    [
        'cost'
    ];

    public function features()
    {
        return $this->hasMany(Feature::class,'featureable_id')->where('featureable_type',FeatureTypeEnum::PACKAGE->value);
    }

    /**
     * Get current description of the the Room
     * @return HasOne
     */
    public function currentDescription() :HasOne
    {
        return $this->hasOne(PackageDescription::class)->where('language_id', config('current_language_id'));
    }
}
