package com.sdtool.common.entity.doc;

import com.sdtool.common.entity.base.BaseEntity;
import com.sdtool.common.tdoc.ApiPlace;
import com.sweetfish.util.Comment;
import org.rex.db.RColumn;

/**
 * Created by jlutt on 2018-10-25.
 * 业务脚本
 *
 * @author jlutt
 */
public class BusinessScript extends BaseEntity {

    @Comment("id")
    @ApiPlace("/doc/getBusinessScriptInfo")
    @ApiPlace("/doc/updateBusinessScript")
    @ApiPlace("/doc/voidBusinessScript")
    private long id;

    @Comment("业务名称")
    @RColumn("businessname")
    @ApiPlace("/doc/getBusinessScriptList")
    @ApiPlace("/doc/getBusinessScriptInfo")
    @ApiPlace("/doc/addBusinessScript")
    @ApiPlace("/doc/updateBusinessScript")
    private String businessName;

    @Comment("业务代码，纯英文，代码中使用此代码进行脚本调用，保证唯一")
    @RColumn("businesscode")
    @ApiPlace("/doc/getBusinessScriptList")
    @ApiPlace("/doc/getBusinessScriptInfo")
    @ApiPlace("/doc/addBusinessScript")
    @ApiPlace("/doc/updateBusinessScript")
    @ApiPlace("/doc/voidBusinessScript")
    private String businessCode;

    @Comment("模块")
    @RColumn("businessmodule")
    @ApiPlace("/doc/getBusinessScriptList")
    @ApiPlace("/doc/getBusinessScriptInfo")
    @ApiPlace("/doc/addBusinessScript")
    @ApiPlace("/doc/updateBusinessScript")
    @ApiPlace("/doc/voidBusinessScript")
    private int businessModule;

    @Comment("系统内置标记，不允许修改，由其他单元自动生成")
    @RColumn("systemflag")
    private int systemFlag;

    @Comment("公共标记0 supplier单独 1公共脚本")
    @RColumn("commonflag")
    private int commonFlag;

    @Comment("启用、禁用标记")
    @RColumn("voidflag")
    @ApiPlace("/doc/getBusinessScriptList")
    @ApiPlace("/doc/voidBusinessScript")
    private int voidFlag;

    private String loadServiceClassName;

    public BusinessScript() {
    }

    private BusinessScript(Builder builder) {
        setId(builder.id);
        setBusinessName(builder.businessName);
        setBusinessCode(builder.businessCode);
        setBusinessModule(builder.businessModule);
        setSystemFlag(builder.systemFlag);
        setCommonFlag(builder.commonFlag);
        setVoidFlag(builder.voidFlag);
    }

    public static Builder newBuilder() {
        return new Builder();
    }


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getBusinessName() {
        return businessName;
    }

    public void setBusinessName(String businessName) {
        this.businessName = businessName;
    }

    public int getVoidFlag() {
        return voidFlag;
    }

    public void setVoidFlag(int voidFlag) {
        this.voidFlag = voidFlag;
    }

    public String getBusinessCode() {
        return businessCode;
    }

    public void setBusinessCode(String businessCode) {
        this.businessCode = businessCode;
    }

    public int getBusinessModule() {
        return businessModule;
    }

    public void setBusinessModule(int businessModule) {
        this.businessModule = businessModule;
    }

    public int getSystemFlag() {
        return systemFlag;
    }

    public void setSystemFlag(int systemFlag) {
        this.systemFlag = systemFlag;
    }

    public String getLoadServiceClassName() {
        return loadServiceClassName;
    }

    public void setLoadServiceClassName(String loadServiceClassName) {
        this.loadServiceClassName = loadServiceClassName;
    }

    public int getCommonFlag() {
        return commonFlag;
    }

    public void setCommonFlag(int commonFlag) {
        this.commonFlag = commonFlag;
    }

    public static final class Builder {
        private long id;
        private String businessName;
        private String businessCode;
        private int businessModule;
        private int systemFlag;
        private int commonFlag;
        private int voidFlag;

        private Builder() {
        }

        public Builder id(long val) {
            id = val;
            return this;
        }

        public Builder businessName(String val) {
            businessName = val;
            return this;
        }

        public Builder businessCode(String val) {
            businessCode = val;
            return this;
        }

        public Builder businessModule(int val) {
            businessModule = val;
            return this;
        }

        public Builder systemFlag(int val) {
            systemFlag = val;
            return this;
        }

        public Builder commonFlag(int val) {
            commonFlag = val;
            return this;
        }

        public Builder voidFlag(int val) {
            voidFlag = val;
            return this;
        }

        public BusinessScript build() {
            return new BusinessScript(this);
        }
    }
}
