<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class DailyRoomRate extends Model
{
    use HasFactory;

    protected $fillable = [
        'room_id',
        'rate_date',
        'price_breakfast',
        'price_no_breakfast',
        'price_breakfast_3plus',
        'price_no_breakfast_3plus',
        'price_breakfast_discount',
        'price_no_breakfast_discount',
        'price_breakfast_discount_3plus',
        'price_no_breakfast_discount_3plus',
        'min_nights',
        'is_closed',
        'notes',
    ];

    protected function casts(): array
    {
        return [
            'rate_date' => 'date',
            'price_breakfast' => 'decimal:2',
            'price_no_breakfast' => 'decimal:2',
            'price_breakfast_3plus' => 'decimal:2',
            'price_no_breakfast_3plus' => 'decimal:2',
            'price_breakfast_discount' => 'decimal:2',
            'price_no_breakfast_discount' => 'decimal:2',
            'price_breakfast_discount_3plus' => 'decimal:2',
            'price_no_breakfast_discount_3plus' => 'decimal:2',
            'min_nights' => 'integer',
            'is_closed' => 'boolean',
        ];
    }

    public function room()
    {
        return $this->belongsTo(Room::class);
    }
}
