<?php
namespace App\Models\Nanny;
use App\Models\Crm\Customer;
use App\Models\User;
use App\Traits\BelongsToStore;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class NannyOrder extends Model
{
    use BelongsToStore;
    protected $fillable = ['store_id','customer_id','nanny_id','order_no','service_type','start_date','end_date','days','price','status','match_candidates','remark','created_by'];
    protected function casts(): array { return ['service_type'=>'integer','start_date'=>'date','end_date'=>'date','days'=>'integer','price'=>'decimal:2','status'=>'integer','match_candidates'=>'array']; }
    public function customer(): BelongsTo { return $this->belongsTo(Customer::class); }
    public function nanny(): BelongsTo { return $this->belongsTo(Nanny::class); }
    public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); }
    public function reviews(): HasMany { return $this->hasMany(NannyReview::class); }
}
