package com.spring.domain.schedule.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;

import lombok.EqualsAndHashCode;
import lombok.Getter;

@Entity
@Table(name = "QRTZ_TRIGGERS")
@Getter
public class QrtzTriggers {

    @EmbeddedId
    private QrtzTriggersId id;

    @Column(name = "JOB_NAME", nullable = false, length = 200)
    private String jobName;

    @Column(name = "JOB_GROUP", nullable = false, length = 200)
    private String jobGroup;

    @Column(name = "DESCRIPTION", length = 250)
    private String description;

    @Column(name = "NEXT_FIRE_TIME")
    private Long nextFireTime;

    @Column(name = "PREV_FIRE_TIME")
    private Long previousFireTime;

    @Column(name = "PRIORITY")
    private Integer priority;

    @Column(name = "TRIGGER_STATE", nullable = false, length = 16)
    private String triggerState;

    @Column(name = "TRIGGER_TYPE", nullable = false, length = 8)
    private String triggerType;

    @Column(name = "START_TIME", nullable = false)
    private Long startTime;

    @Column(name = "END_TIME")
    private Long endTime;

    @Column(name = "CALENDAR_NAME", length = 200)
    private String calendarName;

    @Column(name = "MISFIRE_INSTR")
    private Short misfireInstruction;

    @Lob
    @Column(name = "JOB_DATA")
    private byte[] jobData;
    
    @Embeddable
    @Getter
    @EqualsAndHashCode
    public static class QrtzTriggersId implements Serializable {
        @Column(name = "SCHED_NAME", length = 120, nullable = false)
        private String schedName;

        @Column(name = "TRIGGER_NAME", length = 200, nullable = false)
        private String triggerName;

        @Column(name = "TRIGGER_GROUP", length = 200, nullable = false)
        private String triggerGroup;
    }

}
