<?php

namespace App\Models;

class PropertyRoomRateMapping extends BaseModel
{
    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'property_room_rate_mapping';
    protected $appends = [];

    const CREATED_AT = 'created_at';
    const UPDATED_AT = 'updated_at';

    protected $dateFormat = 'U';
    protected $guarded = [];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [];

    /**
     * @return mixed
     */


    public function propertyRoomRate()
    {
        return $this->hasOne('App\Models\PropertyRoomRate','id', 'room_rate_id')->select(['id', 'name', 'description', 'min_stay', 'max_stay','accommodation_type']);
    }

    public function propertyRoom()
    {
        return $this->hasOne('App\Models\PropertyRoom','id', 'room_id')->select(['id', 'name', 'room_type_id', 'max_occupancy', 'max_adult', 'max_child', 'max_child_number', 'exclude_occupancy','occupancy_lock', 'room_type_count', 'room_size', 'room_size_type','status']);
    }


    public function propertyRoomRateChannel()
    {
        return $this->hasMany('App\Models\PropertyRoomRateChannelMapping','room_rate_mapping_id', 'id')->select(['id', 'channel_id', 'room_rate_mapping_id', 'has_date', 'start_date', 'end_date', 'status']);
    }

    public function connectedRate()
    {
        return $this->hasOne('App\Models\PropertyRoomRate','id', 'connected_rate_id')->select(['id', 'name', 'description']);
    }


}
