<?php

namespace Modules\Bms\Entities;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/** A QC inspection run against a booking at a given stage. */
class BmsQcInspection extends Model
{
    protected $table = 'bms_qc_inspections';

    protected $fillable = [
        'business_id', 'booking_id', 'checklist_id', 'stage', 'items',
        'score', 'status', 'inspector_id', 'completed_at',
    ];

    protected $casts = [
        'items'        => 'array',
        'score'        => 'integer',
        'completed_at' => 'datetime',
    ];

    public function booking(): BelongsTo
    {
        return $this->belongsTo(BmsBooking::class, 'booking_id');
    }
}
