<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class OrderExchangeItem extends Model
{
    use HasFactory;

    protected $guarded = [];

    protected $casts = [
        'quantity' => 'integer',
        'unit_price' => 'float',
        'line_total' => 'float',
    ];

    public function exchange()
    {
        return $this->belongsTo(OrderExchange::class, 'order_exchange_id');
    }

    public function orderDetail()
    {
        return $this->belongsTo(OrderDetail::class);
    }

    public function item()
    {
        return $this->belongsTo(Item::class);
    }
}
