<?php

namespace App\Models;

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

class Courier extends Model
{
    use HasFactory;

    protected $guarded = [];

    protected $casts = [
        'opening_balance' => 'float',
        'opening_balance_date' => 'date',
        'opening_balance_synced_at' => 'datetime',
        'current_balance' => 'float',
        'is_active' => 'boolean',
        'settings_payload' => 'array',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    public function shipments()
    {
        return $this->hasMany(OrderCourierShipment::class);
    }

    public function ledgerEntries()
    {
        return $this->hasMany(CourierLedgerEntry::class);
    }

    public function settlements()
    {
        return $this->hasMany(CourierSettlement::class);
    }
}
