<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Booking extends Model
{
    protected $fillable = [
        'customer_id',
        'tailor_id',
        'appointment_date',
        'service_type',
        'status',
        'notes',
        'total_price',
        'payment_status',
        'payment_method',
        'measurement_id'
    ];

    protected $casts = [
        'appointment_date' => 'datetime',
        'total_price' => 'decimal:2'
    ];

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

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

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