<?php

namespace App\Models;

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

class ServiceSong extends Model
{
    use HasFactory;

    protected $fillable = [
        'service_id',
        'song_id',
        'song_arrangement_id',
        'use_translation',
        'order',
        'cts_song_name',
        'cts_ccli_id',
        'cts_song_id',
        'matched_at',
        'request_sent_at',
    ];

    protected function casts(): array
    {
        return [
            'use_translation' => 'boolean',
            'matched_at' => 'datetime',
            'request_sent_at' => 'datetime',
        ];
    }

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

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

    public function arrangement(): BelongsTo
    {
        return $this->belongsTo(SongArrangement::class, 'song_arrangement_id');
    }
}
