package com.jsowell.adapay.response;

import com.alibaba.fastjson2.annotation.JSONField;
import com.jsowell.common.util.StringUtils;
import lombok.*;

import java.util.List;

/**
 * 查询取现对象response
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class QueryDrawCashResponse extends AdapayBaseResponse{
    @JSONField(name = "cash_list")
    private List<Cash> cashList;

    @JSONField(name = "prod_mode")
    private String prodMode;

    @Getter
    @Setter
    public static class Cash{
        @JSONField(name = "cash_id")
        private String cashId;

        @JSONField(name = "trans_stat")
        private String transStat;

        @JSONField(name = "cash_amt")
        private String cashAmt;

        public String getTransStatusDesc() {
            String transStatusDesc;
            if (StringUtils.equals("F", transStat)) {
                transStatusDesc = "失败";
            } else if (StringUtils.equals("P", transStat)) {
                transStatusDesc = "处理中";
            } else {
                transStatusDesc = "成功";
            }
            return transStatusDesc;
        }
    }
}
