package com.cisdi.data.DIClient.protocol.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: lhp
 * @date: 2019/10/8
 **/

public class IXComActionParamDTO {

    public enum PropertyType {
        BYTE,
        BOOLEAN,
        SHORT,
        INT,
        FLOAT,
        DOUBLE,
        STRING,
        LONG,
        PLACEHOLDER;
    }

    /**
     * 属性列表
     */
    private List<PropertyConfig> propertyList;
    
    /**
     * 电文号
     */
    private String msgKey;
    
    /**
     * 是否透传
     */
    private Boolean isPassthrough;
    
	public Boolean getIsPassthrough() {
		return isPassthrough;
	}

	public void setIsPassthrough(Boolean isPassthrough) {
		this.isPassthrough = isPassthrough;
	}

	public String getMsgKey() {
		return msgKey;
	}

	public void setMsgKey(String msgKey) {
		this.msgKey = msgKey;
	}

	public void appendProperty(PropertyConfig propertyConfig) {

        if (propertyConfig == null) {
            return;
        }

        if (propertyList == null) {
            propertyList = new ArrayList<>();
        }
        propertyList.add(propertyConfig);
    }

    public static class PropertyConfig{

        /** 属性Id*/
        private String propertyId;

        /** 属性类型*/
        private PropertyType propertyType;

        /**固定长度*/
        private Integer fixedLength;
        
        /**精度*/
        private Integer precision;

        public String getPropertyId() {
            return propertyId;
        }

        public void setPropertyId(String propertyId) {
            this.propertyId = propertyId;
        }

        public PropertyType getPropertyType() {
            return propertyType;
        }

        public void setPropertyType(PropertyType propertyType) {
            this.propertyType = propertyType;
        }

		public Integer getFixedLength() {
			return fixedLength;
		}

		public void setFixedLength(Integer fixedLength) {
			this.fixedLength = fixedLength;
		}

		public Integer getPrecision() {
			return precision;
		}

		public void setPrecision(Integer precision) {
			this.precision = precision;
		}

		@Override
		public String toString() {
			return "PropertyConfig [propertyId=" + propertyId + ", propertyType=" + propertyType + ", fixedLength="
					+ fixedLength + ", precision=" + precision + "]";
		}
    }

    public List<PropertyConfig> getPropertyList() {
        return propertyList;
    }

    public void setPropertyList(List<PropertyConfig> propertyList) {
        this.propertyList = propertyList;
    }

	@Override
	public String toString() {
		return "IXComActionParamDTO [propertyList=" + propertyList + ", isPassthrough=" + isPassthrough + "]";
	}
}
