package com.muyu.rule.common.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.rule.common.domain.req.VersionAddReq;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * @Author：张承志
 * @Package：com.muyu.rule.common.domain.resp
 * @Project：cloud-etl-rule
 * @name：RuleEngineVersion
 * @Date：2024/8/25 10:34
 */
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "rule_engine_version",autoResultMap = true)
public class RuleEngineVersion extends BaseEntity {

    /**
     * 版本主键
     */
    @TableId(value = "id" , type = IdType.AUTO)
    private Long id;
    /**
     * 版本名称
     */
    private String    versionName;
    /**
     * 版本类名
     */

    private String className;
    /**
     * 版本编码
     */
    private String   versionCode;
    /**
     * 规则引擎外键
     */
    private String    ruleId;
    /**
     * 是否开启规则引擎
     */
    private String    open;
    /**
     * 版本描述
     */
    private String    versionDesc;

    /**
     * 状态 0正常 1.停用
     */

    private String status;

    /**
     * 引擎类
     */

    private String    versionClazz;



    public static RuleEngineVersion addBuild(VersionAddReq versionAddReq){

      return   RuleEngineVersion.builder()
                .ruleId(versionAddReq.getRuleId())
                .open(versionAddReq.getOpen())
                .status(versionAddReq.getStatus())
                .versionName(versionAddReq.getVersionName())
                .versionCode(versionAddReq.getVersionCode())
                .versionDesc(versionAddReq.getVersionDesc())
                .versionClazz(versionAddReq.getVersionClazz())
                .className(versionAddReq.getClassName())
                .build();

    }



}
