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

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;
import lombok.ToString;

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

@Entity
@Table(name = "tseairm23")
@org.hibernate.annotations.Table(appliesTo = "tseairm23", comment = "모니터링 프라퍼티 그룹")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class MonitoringPropertyGroup extends AbstractEntity<String> implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(unique = true, nullable = false, length = 50)
	@Comment("프라퍼티그룹명")
	private String prptyGroupName;

	@Column(nullable = false, length = 200)
	@Comment("프라퍼티 그룹설명")
	private String prptyGroupDesc;

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

	@OneToMany(mappedBy = "monitoringPropertyGroup", cascade = CascadeType.ALL, orphanRemoval = true)
	@ToString.Exclude
	@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
	private List<MonitoringProperty> monitoringProperties;
}
