<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    protected $fillable = [
        'client_id',
        'fibre_type_id',
        'quantity',
        'unit_price',
        'total_price',
        'creation_date',
    ];

    protected $casts = [
        'quantity' => 'decimal:2',
        'unit_price' => 'decimal:2',
        'total_price' => 'decimal:2',
        'creation_date' => 'date',
    ];

    public function client()
    {
        return $this->belongsTo(Client::class);
    }

    public function fibreType()
    {
        return $this->belongsTo(FibreType::class);
    }

    // Removed payments relationship as payments are now client-based
}
