package com.eactive.eai.rms.onl.apim.approval;

import com.eactive.apim.portal.approval.entity.ApproverStatus;
import com.eactive.eai.data.converter.LocalDateTimeFormatters;
import com.eactive.eai.rms.common.acl.user.ui.UserUI;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

@Data
public class PortalApprovalApproverUI {

    private Long ordinal;

    private UserUI user;

    private ApproverStatus approverStatus;
    private String approverStatusDescription;

    private String approvalMessage;

    @JsonFormat(pattern = LocalDateTimeFormatters.FORMAT_YYYY_MM_DD_HH_MM_SS_19)
    @DateTimeFormat(pattern = "yyyyMMddHHmmssSSS")
    private LocalDateTime approvedDate;

    public String getApproverStatusDescription() {
        return approverStatus != null ? approverStatus.getDescription() : "";
    }
}
