<?php

namespace App\Models;

use App\Traits\AuditLogTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class AliquotTransaction extends BaseModel
{
    public $timestamps = false;

    use HasFactory;
    use AuditLogTrait;

    protected $table = 'aliquot_transactions';

    protected $primaryKey = 'id';

    protected $fillable = [
        'aliquot_id',
        'transaction_type_concept_id',
        'transaction_at',
        'performed_by',
        'source_volumn',
        'affected_volume',
        'remaining_volume',
        'volume_unit',
        'storage_position_id',
        'reference_number',
        'description',
        'state',
        BaseModel::CREATED_AT_FIELD,
        BaseModel::CREATED_BY_FIELD,
        BaseModel::UPDATED_AT_FIELD,
        BaseModel::UPDATED_BY_FIELD,
        BaseModel::DELETED_AT_FIELD,
        BaseModel::DELETED_BY_FIELD,
        BaseModel::RECORD_STATUS_FIELD,
    ];

    public static function boot()
    {
        parent::boot();
    }

    public function aliquot()
    {
        return $this->belongsTo(Aliquot::class, 'aliquot_id', 'id');
    }

    public function position()
    {
        return $this->belongsTo(Position::class, 'storage_position_id', 'id');
    }
}
