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

import java.time.LocalDateTime;
import java.util.List;

import jakarta.persistence.Column;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@DiscriminatorValue("TASK_VOTE")
public class CommunityTaskVoteEntity extends BaseCommunityDisplayEntity {

	@Column
	private boolean active;
	@Column(nullable = false)
	private LocalDateTime expiresAt;
	/** null until completed */
	@Column
	private Integer winningTaskIndex;

	@Override
	public String getType() { return "TASK_VOTE"; }

	public CommunityTaskVoteDTO toCommunityTaskVote(List<CommunityTaskVoteEntryDTO> entries) {
		return new CommunityTaskVoteDTO(getDisplayId(), getLockId(), expiresAt, getLockeeId(), getKeyholderId(), active,
				expiresAt, 0, entries);
	}
}
