package com.malk.pro.tenant;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * {@code tenant.registry.*} 配置绑定
 */
@Data
@Component
@ConfigurationProperties(prefix = "tenant.registry")
public class TenantRegistryProperties {

    /** 宜搭应用表 formUuid（必填） */
    private String formUuid;

    /** 租户记录刷新 TTL，秒 */
    private long ttlSeconds = 600;

    /** 启动时全量加载失败是否抛异常（生产建议 true） */
    private boolean failFast = false;

    /** 字段映射（可覆盖默认命名） */
    private FieldMap field = new FieldMap();

    @Data
    public static class FieldMap {
        private String tenantId = "textField_tenantId";
        private String vendor = "textField_vendor";
        private String appKey = "textField_appKey";
        private String appSecret = "textField_appSecret";
        private String corpId = "textField_corpId";
        private String extraJson = "textareaField_extraJson";
        private String enabled = "radioField_enabled";
    }
}
