<?php

namespace App\Modules\Inventory\Models;

use App\Modules\Admin\Tenancy\Traits\BelongsToTenant;
use App\Modules\Inventory\Support\InventoryUserStamp;
use App\Modules\Inventory\Support\LogsInventoryCatalogActivity;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class WarehouseSection extends Model
{
    use BelongsToTenant;
    use InventoryUserStamp;
    use LogsInventoryCatalogActivity;

    protected $table = 'inventory_warehouse_sections';

    protected $fillable = [
        'tenant_id',
        'warehouse_id',
        'code',
        'name',
        'is_active',
        'sort_order',
        'created_by',
        'updated_by',
    ];

    protected function casts(): array
    {
        return [
            'is_active' => 'boolean',
        ];
    }

    public function warehouse(): BelongsTo
    {
        return $this->belongsTo(Warehouse::class, 'warehouse_id');
    }
}
