package de.thpeetz.kontor.admin.data;

import de.thpeetz.kontor.common.data.AbstractEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;

@Slf4j
@Getter
@Setter
@ToString
@Entity
@Table(indexes = @Index(columnList = "token"), uniqueConstraints = @UniqueConstraint(columnNames = {"token"}))
public class Token extends AbstractEntity {

    private String token;

    private String name;

    private Date lastUsedDate;

    private boolean enabled;

    @ManyToOne
    @JoinColumn(name="profile_id")
    @NotNull
    private Profile profile;
}
