/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.crov.prase.model.prase;

import com.arrebol.taxiservicios.model.admin.Taxi;
import com.arrebol.taxiservicios.model.catalog.Location;
import com.arrebol.taxiservicios.model.core.Person;
import com.arrebol.taxiservicios.model.core.User;
import com.arrebol.taxiservicios.model.enums.EstatusIncidencia;
import com.arrebol.taxiservicios.model.enums.Riesgo;
import com.crov.prase.model.catalog.TipoSiniestro;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;

/**
 *
 * @author Crov
 */
@Entity
@Table(name = "incidence")
public class Incidence implements Serializable {

    private static final long serialVersionUID = -6653037938225719593L;

    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid2")
    @Column(name = "id", length = 36)
    private String id;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(
            name = "id_location",
            referencedColumnName = "id",
            nullable = false
    )
    private Location location;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(
            name = "driver_id",
            referencedColumnName = "id",
            nullable = false
    )
    private Person driver;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(
            name = "taxi_id",
            referencedColumnName = "id",
            nullable = false
    )
    private Taxi taxi;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(
            name = "id_poliza_prase",
            referencedColumnName = "id",
            nullable = false
    )
    private Poliza poliza;

    @Column(name = "description", nullable = true)
    private String description;

    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(
            name = "type",
            referencedColumnName = "id",
            nullable = false
    )
    private TipoSiniestro type;

    @Column(name = "active", nullable = true)
    private boolean active;

    @Column(name = "folio", nullable = true)
    private String folio;

    @Enumerated(EnumType.STRING)
    @Column(name = "estatus", nullable = true)
    private EstatusIncidencia estatus;

    @Column(name = "responsable", nullable = true)
    private boolean responsable;

    @Column(name = "img_credencial", nullable = true)
    private String imgCredencial;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(
            name = "id_ajustador",
            referencedColumnName = "id",
            nullable = false
    )
    private User ajustador;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(
            name = "created_by",
            referencedColumnName = "id",
            nullable = false
    )
    private User createdBy;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "created_on", length = 19)
    private Date createdOn;

    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(
            name = "last_updated_by",
            referencedColumnName = "id",
            nullable = true
    )
    private User lastUpdatedBy;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "last_updated_on", length = 19, nullable = true)
    private Date lastUpdatedOn;

    public Incidence() {
    }

    public Incidence(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Location getLocation() {
        return location;
    }

    public void setLocation(Location location) {
        this.location = location;
    }

    public Person getDriver() {
        return driver;
    }

    public void setDriver(Person driver) {
        this.driver = driver;
    }

    public Taxi getTaxi() {
        return taxi;
    }

    public void setTaxi(Taxi taxi) {
        this.taxi = taxi;
    }

    public Poliza getPoliza() {
        return poliza;
    }

    public void setPoliza(Poliza poliza) {
        this.poliza = poliza;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public TipoSiniestro getType() {
        return type;
    }

    public void setType(TipoSiniestro type) {
        this.type = type;
    }

    

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public User getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(User createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

    public User getLastUpdatedBy() {
        return lastUpdatedBy;
    }

    public void setLastUpdatedBy(User lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    public Date getLastUpdatedOn() {
        return lastUpdatedOn;
    }

    public void setLastUpdatedOn(Date lastUpdatedOn) {
        this.lastUpdatedOn = lastUpdatedOn;
    }

    public String getFolio() {
        return folio;
    }

    public void setFolio(String folio) {
        this.folio = folio;
    }

    public EstatusIncidencia getEstatus() {
        return estatus;
    }

    public void setEstatus(EstatusIncidencia estatus) {
        this.estatus = estatus;
    }

    public boolean isResponsable() {
        return responsable;
    }

    public void setResponsable(boolean responsable) {
        this.responsable = responsable;
    }

    public String getImgCredencial() {
        return imgCredencial;
    }

    public void setImgCredencial(String imgCredencial) {
        this.imgCredencial = imgCredencial;
    }

    public User getAjustador() {
        return ajustador;
    }

    public void setAjustador(User ajustador) {
        this.ajustador = ajustador;
    }

}
