<?php

namespace App\Models;

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

class CourierSettlementItem extends Model
{
    use HasFactory;

    protected $guarded = [];

    protected $casts = [
        'cod_amount' => 'float',
        'delivery_charge' => 'float',
        'cod_charge' => 'float',
        'return_charge' => 'float',
        'adjustment_amount' => 'float',
        'net_receivable' => 'float',
        'net_received' => 'float',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    public function settlement()
    {
        return $this->belongsTo(CourierSettlement::class, 'courier_settlement_id');
    }

    public function courier()
    {
        return $this->belongsTo(Courier::class);
    }

    public function shipment()
    {
        return $this->belongsTo(OrderCourierShipment::class, 'order_courier_shipment_id');
    }

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