<?php

namespace App\Models\Tenants;

use Illuminate\Database\Eloquent\Model;

/**
 * @mixin IdeHelperSettingFieldDef
 */
class SettingFieldDef extends Model
{
    protected $casts = [
        'option_payload' => 'array',
        'is_core' => 'boolean',
    ];

    protected $fillable = [
        'field_key',
        'label',
        'data_type',
        'input_type',
        'option_source',
        'option_payload',
        'comment',
        'created_at',
        'updated_at',
        'storage_area',
        'storage_key',
        'is_core',
    ];

    // 관계 (테넌트 설정)
    public function tenantSettings()
    {
        return $this->hasMany(TenantFieldSetting::class, 'field_key', 'field_key');
    }
}
