package de.oaa.xxx.admin;

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

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

@Getter
@Setter
@Entity
@Table(name = "admin")
public class AdminEntity {

    @Id
    @Column
    private UUID adminId;

    @Column(nullable = false)
    private UUID userId;

    @Enumerated(EnumType.STRING)
    @Column(length = 20, nullable = false)
    private AdminRolle rolle;

    @Column(nullable = false)
    private LocalDateTime createdAt;

    public static AdminEntity create(UUID userId, AdminRolle rolle) {
        AdminEntity entity = new AdminEntity();
        entity.setAdminId(UUID.randomUUID());
        entity.setUserId(userId);
        entity.setRolle(rolle);
        entity.setCreatedAt(LocalDateTime.now());
        return entity;
    }
}
