package com.kamco.cd.kamcoback.postgres.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;

@Getter
@Setter
@Entity
@Table(name = "tb_menu_mapp")
public class MenuMappEntity {

  @Id
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_menu_mapp_id_gen")
  @SequenceGenerator(
      name = "tb_menu_mapp_id_gen",
      sequenceName = "tb_menu_mapp_seq",
      allocationSize = 1)
  @Column(name = "mapp_uid", nullable = false)
  private Long id;

  @NotNull
  @ManyToOne(fetch = FetchType.LAZY, optional = false)
  @JoinColumn(name = "menu_uid", nullable = false)
  private MenuEntity menuUid;

  @NotNull
  @ColumnDefault("false")
  @Column(name = "deleted", nullable = false)
  private Boolean deleted = false;

  @Size(max = 50)
  @Column(name = "role_code", length = 50)
  private String roleCode;
}
