package com.icomsys.main_vm.db.jpa.entity.system;

import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserAuthGroupId;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

@Table(name = "TB_USER_AUTH_GROUP")
@Entity
@Getter
@Setter
@NoArgsConstructor
@DynamicUpdate
@IdClass(TbUserAuthGroupId.class)
public class TbUserAuthGroup {

    @Id
    @Column(name = "USER_SEQ", nullable = false)
    private Long userSeq;
    @Id
    @Column(name = "AUTH_GROUP_SEQ", nullable = false)
    private Long authGroupSeq;
    @Id
    @Column(name = "SERVICE_GROUP", nullable = false, length = 20)
    private String serviceGroup;
    @Id
    @Column(name = "CUST_CODE", nullable = false, length = 20)
    private String custCode;

    @Builder
    public TbUserAuthGroup(Long userSeq, Long authGroupSeq, String serviceGroup, String custCode) {
        this.userSeq = userSeq;
        this.authGroupSeq = authGroupSeq;
        this.serviceGroup = serviceGroup;
        this.custCode = custCode;
    }
}
