<?php

namespace App\Models;

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

class Label extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'color',
        'hidden_at',
        'last_imported_at',
    ];

    protected function casts(): array
    {
        return [
            'hidden_at' => 'datetime',
            'last_imported_at' => 'datetime',
        ];
    }

    public function songSlides(): HasMany
    {
        return $this->hasMany(SongSlide::class);
    }

    public function macroAssignments(): HasMany
    {
        return $this->hasMany(MacroAssignment::class);
    }

    public function isHidden(): bool
    {
        return $this->hidden_at !== null;
    }
}
