package mx.gob.jumapacelaya.models;

/*Esta clase obtiene los detalles de los tickets*/

import java.sql.Date;
import java.time.LocalDate;
import java.util.List;


public class Ticket {

    private int id;
    private String subject;
    private String description;
    private String status;
    private LocalDate dateCreate;
    private User author;
    private Integer trackerId;
    private List<String> comments;




    public Ticket(int id, String subject, String description, String status, String dateCreate, Integer trackerId) {
        this.id = id;
        this.subject = subject;
        this.description = description;
        this.status = status;
        this.dateCreate = LocalDate.parse(dateCreate);
        this.author = author;
        this.trackerId = trackerId;
        this.comments = comments;
    }

    public int getId() {
        return id;
    }

    public String getSubject() {
        return subject;
    }

    public String getDescription() {
        return description;
    }

    public String getStatus() {
        return status;
    }

    public User getAuthor() {
        return author;
    }

    public void setAuthor(User author) {
        this.author = author;
    }

    public Date getDateCreate() {
        return java.sql.Date.valueOf(this.dateCreate);
    }

    public Integer getTrackerId() {
        return trackerId;
    }

    public void setTrackerId(Integer tipoId) {
        this.trackerId = trackerId;
    }

    public static class User {
        private String username;

        public User(String username) {
            this.username = username;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }
    }


    public String tiempoEst(Integer trackerId) {
        if (trackerId == null) {
            return "Desconocido";
        }

        switch (trackerId) {
            case 5,7,8,11,12:
                return "1-2 dias Max";
            case 2,14,16:
                return "2 hrs Max";
            case 10:
                return "5 dias aprox.";
            case 15:
                return "2-6 hrs Max";
            case 6,13:
                return "2 hrs Max";
            default:
                return "N/A";
        }
    }

    public List<String> getComments() {
        return comments;
    }

    public void setComments(List<String> comments) {
        this.comments = comments;
    }
}
