package com.sdtool.common.entity.base;

import com.sdtool.common.entity.site.ERPTokenUser;
import com.sweetfish.convert.json.JsonConvert;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by jlutt on 2021-05-05
 *
 * @author jlutt
 */
public class ProcessStringItem extends BaseEntity {

    private long id;

    private String itemValue;

    private ERPTokenUser currentUser;

    private String dataSourceId;

    private long supplierCode;

    private final Map<String, JsonConvert> jsonConvertMap = new HashMap<>();

    public ProcessStringItem() {
    }

    private ProcessStringItem(Builder builder) {
        setCreateBy(builder.createBy);
        setCreateTime(builder.createTime);
        setCreateTimeLong(builder.createTimeLong);
        setUpdateBy(builder.updateBy);
        setUpdateTime(builder.updateTime);
        setUpdateTimeLong(builder.updateTimeLong);
        setId(builder.id);
        setItemValue(builder.itemValue);
        setCurrentUser(builder.currentUser);
        setDataSourceId(builder.dataSourceId);
        setSupplierCode(builder.supplierCode);
    }

    public ProcessStringItem addConvert(String name, JsonConvert jsonConvert) {
        this.jsonConvertMap.put(name, jsonConvert);
        return this;
    }

    public JsonConvert getConvert(String name) {
        return jsonConvertMap.get(name);
    }

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

    public long getId() {
        return id;
    }

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

    public String getItemValue() {
        return itemValue;
    }

    public void setItemValue(String itemValue) {
        this.itemValue = itemValue;
    }

    public ERPTokenUser getCurrentUser() {
        return currentUser;
    }

    public void setCurrentUser(ERPTokenUser currentUser) {
        this.currentUser = currentUser;
    }

    public String getDataSourceId() {
        return dataSourceId;
    }

    public void setDataSourceId(String dataSourceId) {
        this.dataSourceId = dataSourceId;
    }

    public long getSupplierCode() {
        return supplierCode;
    }

    public void setSupplierCode(long supplierCode) {
        this.supplierCode = supplierCode;
    }


    public static final class Builder {
        private long createBy;
        private Date createTime;
        private long createTimeLong;
        private long updateBy;
        private Date updateTime;
        private long updateTimeLong;
        private long id;
        private String itemValue;
        private ERPTokenUser currentUser;
        private String dataSourceId;
        private long supplierCode;

        private Builder() {
        }

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

        public Builder createTime(Date val) {
            createTime = val;
            return this;
        }

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

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

        public Builder updateTime(Date val) {
            updateTime = val;
            return this;
        }

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

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

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

        public Builder currentUser(ERPTokenUser val) {
            currentUser = val;
            return this;
        }

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

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

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