<?php

namespace App\Models\Meal;

use App\Models\Crm\Customer;
use App\Traits\BelongsToStore;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;

class DailyMealPlan extends Model
{
    use BelongsToStore;

    protected $fillable = [
        'store_id', 'customer_id', 'plan_date', 'meal_type',
        'dishes', 'special_note', 'status', 'deliver_at',
    ];

    protected function casts(): array
    {
        return [
            'plan_date' => 'date',
            'meal_type' => 'integer',
            'dishes' => 'array',
            'status' => 'integer',
            'deliver_at' => 'datetime',
        ];
    }

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

    public function review(): HasOne
    {
        return $this->hasOne(MealReview::class);
    }
}
