<?php

namespace App\Models;

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

/**
 * Precio por pieza (modo by_garment_type) según servicio, tipo de prenda y opcionalmente tipo de carga.
 */
class LaundryPiecePrice extends Model
{
    protected $table = 'laundry_piece_prices';

    protected $fillable = [
        'etapa_id',
        'garment_type_id',
        'load_type_id',
        'unit_price',
        'is_active',
    ];

    protected $casts = [
        'unit_price' => 'decimal:2',
        'is_active' => 'boolean',
    ];

    public function etapa(): BelongsTo
    {
        return $this->belongsTo(Etapa::class, 'etapa_id');
    }

    public function garmentType(): BelongsTo
    {
        return $this->belongsTo(GarmentType::class, 'garment_type_id');
    }

    public function loadType(): BelongsTo
    {
        return $this->belongsTo(LoadType::class, 'load_type_id');
    }
}
