package it.integry.integrywmsnative.core.REST.model;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * Created by GiuseppeS on 06/03/2018.
 */

public class ServiceRESTResponse<T> {

    private int esito;
    private String execDate;
    private String profileDB;
    private String errorMessage;

    private T dto;
    private T entity;
    private List<T> entityList;

    public EsitoType getEsito() {
        return EsitoType.fromIntValue(esito);
    }

    public Date getExecDate() {
        try {
            return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(execDate);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getProfileDB() {
        return profileDB;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public T getDto() {
        return dto;
    }

    public T getEntity() {
        return entity;
    }

    public List<T> getEntityList() {
        return entityList;
    }
}
