package de.oaa.xxx.games.chastity.community;

import java.time.LocalDateTime;
import java.util.UUID;

import jakarta.persistence.Column;
import jakarta.persistence.DiscriminatorColumn;
import jakarta.persistence.DiscriminatorType;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "community_display")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "display_type", discriminatorType = DiscriminatorType.STRING)
public abstract class BaseCommunityDisplayEntity {

	@Id
	@GeneratedValue(strategy = GenerationType.UUID)
	@Column
	private UUID displayId;
	@Column(nullable = false)
	private UUID lockId;
	@Column(nullable = false)
	private LocalDateTime createdAt;
	@Column(nullable =  false)
	private UUID lockeeId;
	@Column
	private UUID keyholderId;
	
	public abstract String getType();

	public BaseCommunityDisplayDTO toBaseCommunityDisplay(String lockeeName) {
		return new BaseCommunityDisplayDTO(displayId, lockId, createdAt, lockeeId, keyholderId, getType(), lockeeName);
	}
}
