<?php

namespace App\Models;

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

// [INTEGRATION] Per-order applied fee — mirrors Flutter order_fees table
class OrderFee extends Model
{
    use HasUlids;

    protected $fillable = [
        'order_id', 'fee_config_id', 'name', 'fee_type', 'amount',
    ];

    protected $casts = [
        'amount' => 'float',
    ];

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

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