package ru.ulstu.deadline.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

public class DeadlineDto {
    private Integer id;

    private String description;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date date;

    public DeadlineDto() {
    }

    @JsonCreator
    public DeadlineDto(@JsonProperty("id") Integer id,
                       @JsonProperty("description") String description,
                       @JsonProperty("date") Date date) {
        this.id = id;
        this.description = description;
        this.date = date;
    }

    public DeadlineDto(Deadline deadline) {
        this.id = deadline.getId();
        this.description = deadline.getDescription();
        this.date = deadline.getDate();
    }

    public Integer getId() {
        return id;
    }

    public String getDescription() {
        return description;
    }

    public Date getDate() {
        return date;
    }

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

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

    public void setDate(Date date) {
        this.date = date;
    }
}
