package com.viettel.campaign.model.ccms_full;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "CUSTOMIZE_FIELDS")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CustomizeFields implements Serializable {
    @Id
    @GeneratedValue(generator = "CUSTOMIZE_FIELDS_SEQ")
    @SequenceGenerator(name = "CUSTOMIZE_FIELDS_SEQ", sequenceName = "CUSTOMIZE_FIELDS_SEQ", allocationSize = 1)
    @Basic(optional = false)
    @NotNull
    @Column(name = "CUSTOMIZE_FIELD_ID")
    private Long customizeFieldId;
    @Column(name = "SITE_ID")
    private Long siteId;
    @Column(name = "FUNCTION_CODE")
    private String functionCode;
    @Column(name = "CREATE_BY")
    private String createBy;
    @Column(name = "CREATE_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Column(name = "UPDATE_BY")
    private String updateBy;
    @Column(name = "UPDATE_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateDate;
    @Column(name = "STATUS")
    private Long status;
    @Column(name = "TYPE")
    private String type;
    @Column(name = "TITLE")
    private String title;
    @Column(name = "PLACEHOLDER")
    private String placeholder;
    @Column(name = "DESCRIPTION")
    private String description;
    @Column(name = "POSITION")
    private Long position;
    @Column(name = "REQUIRED")
    private Long required;
    @Column(name = "FIELD_OPTIONS_ID")
    private Long fieldOptionsId;
    @Column(name = "REGEXP_FOR_VALIDATION")
    private String regexpForValidation;
    @Column(name = "MAX_LENGTH")
    private Long maxLength;
    @Column(name = "MIN_LENGTH")
    private Long minLength;
    @Column(name = "MIN")
    private Long min;
    @Column(name = "MAX")
    private Long max;
    @Column(name = "ACTIVE")
    private Long active;

    public CustomizeFields(String type, String title) {
        this.type = type;
        this.title = title;
    }
}
