<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;

#[Fillable(['order_id', 'customer_id', 'user_id', 'checklist', 'general_note', 'evidence_paths', 'signature_path', 'delete_after'])]
class DigitalForm extends Model
{
    protected function casts(): array
    {
        return [
            'checklist' => 'array',
            'evidence_paths' => 'array',
            'delete_after' => 'datetime',
        ];
    }

    public function order()
    {
        return $this->belongsTo(Order::class);
    }

    public function customer()
    {
        return $this->belongsTo(Customer::class);
    }

    public function items()
    {
        return $this->hasMany(DigitalFormItem::class);
    }
}
