package org.example.Entity.System;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;

import java.util.Map;

import static org.example.Utils.DataTableUtil.get;
import static org.example.Utils.DataTableUtil.getStringValue;
import static org.example.Utils.NativeExtensionUtils.ToInt32;
import static org.example.Utils.NativeExtensionUtils.toBoolean;

public class BaseDetailModule extends ModuleEntity {
    public BaseDetailModule() {
        super();
    }

    public BaseDetailModule(Map<String, Object> row) {
        super(row);
    }

    @JsonIgnore
    public String getDetailId() {

        return getStringValue(basemodule, "id", null, null);

    }

    private String _unionKey;

    @JsonIgnore
    public void setUnionKey(String unionKey) {
        this._unionKey = unionKey;
    }

    public String getUnionKey() {
        return getStringValue(basemodule, "unionkey", _unionKey, null);

    }

    private String _unionMenuCode;

    public String getUnionMenuCode() {
        return (String) get(basemodule, "UnionMenuCode", _unionMenuCode, null);
    }

    public void setUnionMenuCode(String unionMenuCode) {

        this._unionMenuCode = unionMenuCode;
    }


    private String _unionField;

    public String getUnionField() {
        return (getStringValue(basemodule, "UnionField", _unionField, null)).toLowerCase();
    }

    public void setUnionField(String unionField) {

        this._unionField = unionField;
    }


    private String _unionParentField;

    @JsonProperty("UnionParentField")
    public String getUnionParentField() {
        return (getStringValue(basemodule, "UnionParentField", _unionParentField, null)).toLowerCase();
    }

    public void setUnionParentField(String unionParentField) {

        this._unionParentField = unionParentField;
    }


    private String _unionValue;

    public String getUnionValue() {
        return (getStringValue(basemodule, "UnionValue", _unionValue, null)).toLowerCase();
    }

    public void setUnionValue(String unionValue) {

        this._unionValue = unionValue;
    }


    private String _unionSql;

    /// <summary>
/// 明细sql
/// </summary>
    public String getUnionSql() {
        return (String) get(basemodule, "UnionSQL", _unionSql, null);
    }

    public void setUnionSql(String unionSql) {


        this._unionSql = unionSql;
    }


    private String _unionCond;

    /// <summary>
/// 主表关联明细的条件，有条件就不用关联字段
/// </summary>
    public String getUnionCond() {
        return (String) get(basemodule, "unionCond", _unionCond, null);
    }

    public void setUnionCond(String unionCond) {


        this._unionCond = unionCond;
    }


    private Integer _unionType;

    public Integer getUnionType() {
        return ToInt32(get(basemodule, "detailType", _unionType, null));
    }

    public void setUnionType(Integer unionType) {

        this._unionType = unionType;
    }


    private Boolean _refresh;

    public Boolean getRefresh() {
        return toBoolean(get(basemodule, "Refresh", _refresh, null));
    }

    public void setRefresh(Boolean refresh) {

        this._refresh = refresh;
    }


    private Boolean _addFlag;

    public Boolean getAddFlag() {
        return toBoolean(get(basemodule, "AddFlag", _addFlag, null));
    }

    public void setAddFlag(Boolean addFlag) {

        this._addFlag = addFlag;
    }


    private Integer _displayrows;

    public Integer getDisPlayRows() {
        return ToInt32(get(basemodule, "displayrows", _displayrows, null));
    }

    public void setDisPlayRows(Integer displayrows) {

        this._displayrows = displayrows;
    }


}