<?php

declare(strict_types=1);

namespace App\Models\Market;

use App\Models\Model;
use App\Models\User;

class Courier extends Model
{
    protected ?string $table = 'couriers';

    protected array $fillable = [
        'hashkey',
        'name',
        'contact_number',
        'type',
        'is_active',
        'created_by',
        'updated_by',
    ];

    protected array $casts = [
        'is_active' => 'boolean',
    ];

    public function shipments()
    {
        return $this->hasMany(Shipment::class, 'courier_id');
    }

    public function creator()
    {
        return $this->belongsTo(User::class, 'created_by');
    }

    public function updater()
    {
        return $this->belongsTo(User::class, 'updated_by');
    }
}
