<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;

/**
 * @property mixed umrah_trip_date
 */
class UmrahTrip extends Model
{
    protected $fillable = [
//        'umrah_trip_type',
        'house_type',
        'price_per_person',
        'umrah_trip_date',
        'departure_city',
        'arrival_city',
        'rally_point_info',
        'image',
        'status',
    ];

    protected $casts = ['rally_point_info' => 'array', 'umrah_trip_date' => 'array'];

    public function descriptions() :HasMany
    {
        return $this->hasMany(UmrahTripDescription::class);
    }

    /**
     * Get description of current language for pages
     * @return HasOne
     */
    public function currentDescription() :HasOne
    {
        return $this->hasOne(UmrahTripDescription::class)->where('language_id', currentLanguage()->id);
    }

    public function reservations()
    {
        return $this->hasMany(UmrahTripReservation::class);
    }
}
