<?php

namespace App\Models;

use App\Traits\Multitenantable;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;

class StockCard extends Model
{
    use Multitenantable;

    public $primaryKey = 'uuid';

    public $incrementing = false;
    public $keyType = 'string';
    public $timestamps = false;
    protected $fillable = [
        'uuid',
        'tenant_id',
        'outlet_inventory_id',
        'user_id',
        'type',
        'reference_id',
        'receive_from_id',
        'receive_from_name', 
        'document_number',
        'qty_change',
        'current_stock',
        'stock_type',
        'mode_change',
        'mode_before_change', 
        'mode_after_change',
        'cost_price',
        'notes',
        'created_at'
    ];

    protected $casts = [
        'mode_change' => 'boolean',
        'created_at' => 'datetime'
    ];

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }
}
