<?php

namespace Modules\MedRegistry\Entities;

use Illuminate\Database\Eloquent\Model;

/**
 * Business-type preset (hospital, polyclinic, …, custom) with its default /
 * optional module lists as spec_keys — exactly the table in SPEC-INDEX §1.
 */
class MedregBusinessType extends Model
{
    protected $table = 'medreg_business_types';

    protected $guarded = ['id'];

    protected $casts = [
        'default_modules'  => 'array',
        'optional_modules' => 'array',
        'is_active'        => 'boolean',
        'sort_order'       => 'integer',
    ];

    const TYPE_CUSTOM = 'custom';

    /** Meta keys inside preset lists, expanded by PresetService / the wizard. */
    const META_ALL_SPECIALTIES = 'all_specialty_modules';
    const META_ONE_SPECIALTY   = 'one_specialty_module_of_choice';

    public function isCustom(): bool
    {
        return $this->type_key === self::TYPE_CUSTOM;
    }
}
