package cn.stylefeng.team.form.api.entity;

import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseBusinessEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.util.sort.GetSortKey;
import cn.stylefeng.team.form.api.pojo.FormDesignVo;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;

@TableName(value = "devops_form_definition", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
public class FormDefinition extends BaseBusinessEntity implements GetSortKey {

    @TableId(value = "form_definition_id", type = IdType.ASSIGN_ID)
    @ChineseDescription("表单定义id")
    private Long formDefinitionId;

    @TableField("business_category_id")
    @ChineseDescription("所属业务分类id")
    private Long businessCategoryId;

    @TableField("business_id")
    @ChineseDescription("所属业务id")
    private Long businessId;

    @TableField("form_model_id")
    @ChineseDescription("所属表单模型id")
    private Long formModelId;

    @TableField("fld_version")
    @ChineseDescription("模型定义的版本号，例如：1.0")
    private String fldVersion;

    @TableField(value = "form_config", typeHandler = JacksonTypeHandler.class)
    @ChineseDescription("PC端-表单配置的JSON")
    private FormDesignVo formConfig;

    @TableField(value = "mobile_form_config", typeHandler = JacksonTypeHandler.class)
    @ChineseDescription("移动端-表单配置的JSON")
    private FormDesignVo mobileFormConfig;

    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    @ChineseDescription("租户id")
    private Long tenantId;

    @Override
    public Object getSortKey() {
        return formDefinitionId;
    }

}
