<?php

namespace App\Models\Room;

use App\Models\Crm\Customer;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class CustomerOuting extends Model
{
    protected $fillable = [
        'reservation_id', 'customer_id', 'out_at', 'expected_back_at',
        'actual_back_at', 'reason', 'risk_note', 'created_by',
    ];

    protected function casts(): array
    {
        return [
            'out_at' => 'datetime',
            'expected_back_at' => 'datetime',
            'actual_back_at' => 'datetime',
        ];
    }

    public function reservation(): BelongsTo
    {
        return $this->belongsTo(Reservation::class);
    }

    public function customer(): BelongsTo
    {
        return $this->belongsTo(Customer::class);
    }

    public function creator(): BelongsTo
    {
        return $this->belongsTo(User::class, 'created_by');
    }
}
