package com.dbnt.kcgfilemanager.model;

import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;

@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "CATEGORY_ROLE")
@IdClass(CategoryRole.CategoryRoleId.class)
public class CategoryRole {
  @Id
  @Column(name = "USER_SEQ", nullable = false)
  private Integer userSeq;
  @Id
  @Column(name = "CATEGORY_SEQ", nullable = false)
  private Integer categorySeq;

  @Column(name = "CATEGORY_ROLE")
  private String categoryRole;

  @Embeddable
  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  public static class CategoryRoleId implements Serializable {
    private Integer userSeq;
    private Integer categorySeq;
  }

}
