package com.mvc.model.external;

import com.mvc.entity.TAiread;
import com.mvc.utils.DateUtil;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;

public class UNCResponseModel {
    private String deviceId;
    private BigDecimal identValue;
    private String sampleTime;
    private String imageUrl;

    public UNCResponseModel(TAiread tAiread, String userDefinedCode) {
        this.deviceId = userDefinedCode;
        if(tAiread != null){
            if (tAiread.getResultValue() != null) {
                this.identValue = tAiread.getResultValue();
            }
            if (tAiread.getSampleTime() != null) {
                this.sampleTime = DateUtil.formateDate(tAiread.getSampleTime(), DateUtil.PATTERN_DATA_NORMAL);
            }
            this.imageUrl = StringUtils.isNotEmpty(tAiread.getBigJpgUrl()) ? tAiread.getBigJpgUrl() : tAiread.getSmallJpgUrl();
        }
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public BigDecimal getIdentValue() {
        return identValue;
    }

    public void setIdentValue(BigDecimal identValue) {
        this.identValue = identValue;
    }

    public String getSampleTime() {
        return sampleTime;
    }

    public void setSampleTime(String sampleTime) {
        this.sampleTime = sampleTime;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }
}
