package com.iqser.red.service.persistence.management.v1.processor.entity.permissions;

import java.io.Serializable;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "ACL_CUSTOM_PERMISSIONS")
@IdClass(CustomPermissionEntity.CustomPermissionEntityId.class)
public class CustomPermissionEntity {

    @Id
    @Column(name = "target_object")
    private String targetObject;

    @Id
    @Column(name = "target_permission_mask")
    private int targetPermissionMask;

    @Id
    @Column(name = "existing_permission_mask")
    private int existingPermissionMask;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class CustomPermissionEntityId implements Serializable {

        private String targetObject;
        private int targetPermissionMask;
        private int existingPermissionMask;

    }

}
