<?php

namespace App\Models;

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

class Slide extends Model
{
    use HasFactory;
    use SoftDeletes;

    protected $fillable = [
        'type',
        'service_id',
        'service_agenda_item_id',
        'original_filename',
        'stored_filename',
        'thumbnail_filename',
        'cover_mode',
        'expire_date',
        'uploader_name',
        'uploaded_at',
        'sort_order',
    ];

    protected function casts(): array
    {
        return [
            'expire_date' => 'date',
            'uploaded_at' => 'datetime',
            'cover_mode' => 'boolean',
        ];
    }

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

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