<?php

namespace App\Models;

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

class PathogenInventorySample extends BaseModel
{
    public $timestamps = false;

    use HasFactory;
    use AuditLogTrait;

    protected $table = 'samples';

    protected $primaryKey = 'id';

    protected $fillable = [
        'organization_id',
        'pathogen_id',
        'sample_type_concept_id',
        'container_type_id',
        'risk_group_concept_id',
        'biosafety_level_concept_id',
        'sample_code',
        'accession_number',
        'soc_concept_id',
        'collected_at',
        'collected_by',
        'received_date',
        'received_by',
        'initial_volume',
        'volume_unit',
        'remaining_volume',
        'is_own',
        'owner_organization_id',
        'status',
        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 pathogen()
    {
        return $this->belongsTo(Pathogen::class, 'pathogen_id', 'id');
    }

    public function aliquots()
    {
        return $this->hasMany(Aliquot::class, 'sample_id', 'id');
    }
}
