<?php

namespace Modules\Inventory\Models;

use Illuminate\Database\Eloquent\Model;
use Modules\Core\Traits\AuditableTrait;
use Modules\Core\Traits\HasStatus;
use Modules\Inventory\Models\Traits\HasProduct;
use Modules\Inventory\Models\Traits\HasBaseUnit;
use Modules\Inventory\Models\Traits\HasLevelUnit;

// use Modules\Inventory\Database\Factories\ProductUnitConversionFactory;

class ProductUnitConversion extends Model
{
    use HasStatus,
        HasProduct,
        HasLevelUnit,
        AuditableTrait;

    /**
     * The attributes that are mass assignable.
     */
    protected $fillable = [
        'product_id',
        'from_unit_id',
        'from_qty',
        'to_unit_id',
        'to_qty',
        'is_purchase_unit',
        'is_sale_unit',
        'is_default_purchase',
        'is_default_sale',
        'priority',
        'status',
    ];

    public $timestamps = false;

    protected function casts(): array
    {
        return [
            'is_purchase_unit' => 'boolean',
            'is_sale_unit' => 'boolean',
            'is_default_purchase' => 'boolean',
            'is_default_sale' => 'boolean',
        ];
    }
}
