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

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.util.UUID;

@Getter
@Setter
@Entity
@Table(name = "community_task_vote_entry",
       uniqueConstraints = @UniqueConstraint(columnNames = {"voteSessionId", "voterUserId"}))
public class CommunityTaskVoteEntryEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    private UUID entryId;

    @Column(nullable = false)
    private UUID displayId;

    @Column(nullable = false)
    private UUID userId;

    @Column(nullable = false)
    private int taskIndex;
    
    public CommunityTaskVoteEntryDTO toCommunityTaskVoteEntry() {
    	return new CommunityTaskVoteEntryDTO(entryId, displayId, userId, taskIndex);
    }
}
