package com.eactive.eai.rms.common.acl.monitoringCode.UI;

import com.eactive.apim.portal.monitoringcode.entity.MonitoringCode;
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.Data;

@Data
public class MonitoringCodeUI {

	private String id;

	@JsonProperty("CODEGROUP")
	private String codeGroup;

	@JsonProperty("CODE")
	private String code;

	@JsonProperty("CODENAME")
	private String codeName;

	@JsonProperty("SEQ")
	private Integer seq;

	@JsonProperty("PARENTCODE")
	private String parentCode;

	@JsonProperty("USEYN")
	private String useYn;

	@JsonProperty("USEYNNAME")
	private String useYnName;

	private String parent;

	private Integer level;

	private String expanded = "true";

	private String isLeaf = "false";

	public MonitoringCodeUI(MonitoringCode monitoringCode, Integer level) {
		this.level = level;
		this.id = monitoringCode.getId().getCode();
		this.parent = monitoringCode.getParentCode();
		this.code = monitoringCode.getId().getCode();
		this.codeGroup = monitoringCode.getId().getCodeGroup();
		this.parentCode = monitoringCode.getParentCode();
		this.codeName = monitoringCode.getCodeName();
		this.seq = monitoringCode.getSeq();
		this.useYn = monitoringCode.getUseYn();

		if (level > 0) {
			this.isLeaf = "true";
		}
	}

	public MonitoringCodeUI(String code, String codeName) {
		this.code = code;
		this.codeName = codeName;
	}

	public MonitoringCodeUI() {
	}

}
