package com.eactive.eai.rms.common.acl.role;

import com.eactive.eai.rms.data.entity.man.menu.Menu;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.List;

@Data
public class RoleMenuTreeUI {

	private String id;

	@JsonProperty("MENUID")
	private String menuId;

	private String parent;

	@JsonProperty("SORTORDER")
	private Integer sortOrder;

	@JsonProperty("MENUNAME")
	private String menuName;

	@JsonProperty("USEYN")
	private String useYn;

	@JsonProperty("DISPLAYYN")
	private String displayYn;

	private Integer level;

	private String expanded;

	private String isLeaf;

	private String auth;

   @JsonProperty("renderTarget")
   private List<String> renderTarget;

   @JsonProperty("serviceType")
   private List<AuthByService> authsByService;

   public RoleMenuTreeUI(Menu menu, Integer level, List<String> renderTarget, List<AuthByService> authsByService) {
		this.id = menu.getId();
		this.menuId = menu.getId();
		this.parent = menu.getParentMenuId();
		this.sortOrder = menu.getSortOrder();
		this.level = level;
		this.displayYn = menu.getDisplayYn();
		this.useYn = menu.getUseYn();
		this.menuName = menu.getMenuName();
		this.expanded = "true";
		this.isLeaf = menu.getChildMenus().isEmpty() ? "true" : "false";
      this.renderTarget = renderTarget;
      this.authsByService = authsByService;
	}

	public RoleMenuTreeUI() {
	}

}
