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

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

import javax.persistence.*;
import java.time.LocalDateTime;

@Table(name = "TB_CALL_USER_LOG")
@Entity
@Getter
@Setter
@NoArgsConstructor
@DynamicUpdate
@IdClass(TbCallUserLogId.class)
public class TbCallUserLog {

    @Id
    @Column(name = "TOKEN", nullable = false, length = 44)
    private String token;

    @Id
    @Column(name = "TALK_SEQ", nullable = false)
    private int talkSeq;

    @Column(name = "OPR_MNG_CODE", nullable = false, length = 100)
    private String oprMngCode;

    @Column(name = "USER_TEXT", nullable = true, length = 1000)
    private String userText;

    @Column(name = "INTENT_ID", nullable = true)
    private Long intentId;

    @Column(name = "INTENT_NAME", nullable = true, length = 50)
    private String intentName;

    @Column(name = "SCORE", nullable = true, length = 10)
    private String score;

    @Column(name = "IF_MAPPING_ID", nullable = true)
    private Long ifMappingId;

    @Column(name = "IF_RETURN_CODE", nullable = true, length = 10)
    private String ifReturnCode;

    @Column(name = "IF_RETURN_MSG", nullable = true, length = 200)
    private String ifReturnMsg;

    @Column(name = "REGIST_DATE", nullable = true)
    private LocalDateTime registDate;

//    SCORE_FAIL : 점수 미달
//    INTENT_FAIL : 인텐트 실패
//    INTENT_SUCCESS : 인텐트 성공
    @Column(name = "INTENT_RESULT_CODE", nullable = true, length = 20)
    private String intentResultCode;

    @Column(name = "SCENARIO_NAME", nullable = true,length = 200)
    private String scenarioName;

    @Column(name = "SCENARIO_SEQ", nullable = true)
    private Long scenarioSeq;

    @Builder
    public TbCallUserLog(String token, int talkSeq, String oprMngCode, String userText, Long intentId, String intentName, String score, String intentResultCode, Long ifMappingId, String ifReturnCode, String ifReturnMsg, LocalDateTime registDate, Long scenarioSeq, String scenarioName) {
        this.token = token;
        this.talkSeq = talkSeq;
        this.oprMngCode = oprMngCode;
        this.userText = userText;
        this.intentId = intentId;
        this.intentName = intentName;
        this.score = score;
        this.intentResultCode = intentResultCode;
        this.ifMappingId = ifMappingId;
        this.ifReturnCode = ifReturnCode;
        this.ifReturnMsg = ifReturnMsg;
        this.registDate = registDate;
        this.scenarioSeq = scenarioSeq;
        this.scenarioName = scenarioName;
    }


}
