<?php

namespace App\Modules\HR\Shifts\Models;

use App\Modules\Admin\Tenancy\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class ShiftRotation extends Model
{
    use BelongsToTenant;

    protected $table = 'hr_shift_rotations';

    protected $fillable = ['tenant_id', 'name', 'is_active'];

    protected function casts(): array
    {
        return ['is_active' => 'boolean'];
    }

    public function days(): HasMany
    {
        return $this->hasMany(ShiftRotationDay::class, 'rotation_id')->orderBy('day_number');
    }
}
