package de.thpeetz.kontor.admin.data;

import de.thpeetz.kontor.common.data.AbstractEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.OneToMany;
import jakarta.validation.constraints.NotEmpty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Nullable;
import java.util.List;

@Slf4j
@Getter
@Setter
@ToString
@Entity
public class Permission extends AbstractEntity {

    @NotEmpty
    private String name;

    @OneToMany(fetch = FetchType.EAGER, mappedBy = "permission")
    @Nullable
    private List<Assignment> assignments;
}
