<?php

namespace App\Models;

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

class ServiceAsset extends Model
{
    protected $fillable = [
        'ticket_id',
        'photo_entry',
        'sig_entry',
        'accessories',
        'physical_condition',
        'device_password',
        'photo_exit',
        'sig_exit',
        'recipient_name',
    ];

    protected $casts = [
        'accessories' => 'array',
    ];

    // ─────────────────────── Relationships ───────────────────────

    /**
     * Tiket servis yang terkait dengan aset ini.
     */
    public function ticket(): BelongsTo
    {
        return $this->belongsTo(ServiceTicket::class, 'ticket_id');
    }
}
