package com.sdtool.common.entity.base;

import com.sdtool.common.entity.site.ERPTokenUser;
import com.sweetfish.source.PageFlipper;
import org.rex.RMap;

/**
 * Created by jlutt on 2022-08-04
 *
 * @author jlutt
 */
@SuppressWarnings("rawtypes")
public class ProcessSearchEntityItem<T extends BaseEntity> extends BaseEntity {

    private T inputItem;

    private RMap itemData;

    private PageFlipper pageFlipper;

    private ERPTokenUser currentUser;

    private String dataSourceId;

    private long supplierCode;

    public ProcessSearchEntityItem() {
    }

    private ProcessSearchEntityItem(Builder<T> builder) {
        setInputItem(builder.inputItem);
        setItemData(builder.itemData);
        setPageFlipper(builder.pageFlipper);
        setCurrentUser(builder.currentUser);
        setDataSourceId(builder.dataSourceId);
        setSupplierCode(builder.supplierCode);
    }

    public static <T extends BaseEntity> Builder<T> newBuilder() {
        return new Builder<>();
    }


    public T getInputItem() {
        return inputItem;
    }

    public void setInputItem(T inputItem) {
        this.inputItem = inputItem;
    }

    public RMap getItemData() {
        return itemData;
    }

    public void setItemData(RMap itemData) {
        this.itemData = itemData;
    }

    public PageFlipper getPageFlipper() {
        return pageFlipper;
    }

    public void setPageFlipper(PageFlipper pageFlipper) {
        this.pageFlipper = pageFlipper;
    }

    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<T extends BaseEntity> {
        private T inputItem;
        private RMap itemData;
        private PageFlipper pageFlipper;
        private ERPTokenUser currentUser;
        private String dataSourceId;
        private long supplierCode;

        private Builder() {
        }

        public Builder<T> inputItem(T val) {
            inputItem = val;
            return this;
        }

        public Builder<T> itemData(RMap val) {
            itemData = val;
            return this;
        }

        public Builder<T> pageFlipper(PageFlipper val) {
            pageFlipper = val;
            return this;
        }

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

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

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

        public ProcessSearchEntityItem<T> build() {
            return new ProcessSearchEntityItem<>(this);
        }
    }
}
