<?php

namespace App\Models;

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

class EventStorageAssignment extends Model
{
    use HasFactory;

    protected $fillable = [
        'event_id',
        'media_storage_target_id',
        'role',
        'status',
        'assigned_at',
        'released_at',
        'meta',
    ];

    protected $casts = [
        'assigned_at' => 'datetime',
        'released_at' => 'datetime',
        'meta' => 'array',
    ];

    public function event(): BelongsTo
    {
        return $this->belongsTo(Event::class);
    }

    public function storageTarget(): BelongsTo
    {
        return $this->belongsTo(MediaStorageTarget::class, 'media_storage_target_id');
    }
}

