<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

final class LicenseClassTemplate extends Model
{
    protected $table = 'license_class_templates';
    protected $fillable = ['tenant_id', 'code', 'name', 'is_combination'];
    protected $casts = ['is_combination' => 'integer'];

    public function tenant(): BelongsTo
    {
        return $this->belongsTo(Tenant::class, 'tenant_id');
    }

    public function requirements(): HasMany
    {
        return $this->hasMany(LicenseTemplateRequirement::class, 'template_id');
    }

    public function students(): HasMany
    {
        return $this->hasMany(Student::class, 'template_id');
    }
}