<?php

namespace App\Models;

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

class CourierReconciliationRow extends Model
{
    use HasFactory;

    protected $guarded = [];

    protected $casts = [
        'courier_cod_amount' => 'float',
        'system_cod_amount' => 'float',
        'courier_charge_amount' => 'float',
        'system_charge_amount' => 'float',
        'courier_settlement_amount' => 'float',
        'system_settlement_amount' => 'float',
        'raw_payload' => 'array',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    public function import()
    {
        return $this->belongsTo(CourierReconciliationImport::class, 'courier_reconciliation_import_id');
    }

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

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