package com.eactive.eai.rms.data.entity.man.role;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Comment;

import com.eactive.eai.data.entity.AbstractEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;

@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)

@Entity
@Table(name = "tseairm05")
@org.hibernate.annotations.Table(appliesTo = "tseairm05", comment = "역할 관리")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Role extends AbstractEntity<String> implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(unique = true, nullable = false, length = 40)
	@Comment("역할ID")
	private String roleId;

	@Column(nullable = false, length = 100)
	@Comment("역할명")
	private String roleName;

	@Column(nullable = false, length = 1)
	@Comment("사용여부")
	private String useYn;

	@Column(nullable = false, length = 400)
	@Comment("역할권한설명")
	private String roleDesc;

	@Column(nullable = false, length = 40)
	@Comment("메뉴ID")
	private String menuId;

	@Override
	public @NonNull String getId() {
		return roleId;
	}

	@OneToMany(mappedBy = "role", cascade = CascadeType.ALL, orphanRemoval = true)
	private List<RoleMenuAuth> roleMenuAuths;
}
