package com.sckw.payment.repose.vo;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.sckw.core.model.page.PageResult;
import com.sckw.payment.model.KwpBizWallet;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * Author: donglang
 * Time: 2025-11-03
 * Des: 钱包明细列表返回
 * Version: 1.0
 */

@Data
public class KwpBizWalletVO extends PageResult {

    /**
     * 主键
     */
    @Schema(description = "主键")
    private Long id;

    /**
     * 供应商企业id
     */
    @Schema(description = "供应商企业id")
    private Long supEntId;

    /**
     * 供应商企业名称
     */
    @Schema(description = "供应商企业名称")
    private String supEntName;

    /**
     * 采购商企业id
     */
    @Schema(description = "采购商企业id")
    private Long proEntId;

    /**
     * 采购商企业名称
     */
    @Schema(description = "采购商企业名称")
    private String proEntName;

    /**
     * 钱包名称
     */
    @Schema(description = "钱包名称")
    private String name;

    /**
     * 可用金额（单位：元，保留2位小数）
     */
    @Schema(description = "可用金额")
    private BigDecimal amount;

    /**
     * 冻结金额（单位：元，保留2位小数）
     */
    @Schema(description = "冻结金额")
    private BigDecimal prepayAmount;

    /**
     * 类型 0-线下钱包
     */
    @Schema(description = "类型 0-线下钱包")
    private Integer type;

    /**
     * 状态 1-开启，0-关闭
     */
    @Schema(description = "状态 1-开启，0-关闭")
    private Integer state;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 创建人
     */
    @Schema(description = "创建人")
    private String createUser;

    /**
     * 更新人
     */
    @Schema(description = "更新人")
    private String updateUser;

    private static KwpBizWalletVO getInstance() {
        return new KwpBizWalletVO();
    }


    public static KwpBizWalletVO toPageResp(KwpBizWallet wallet) {
        if (wallet == null) {
            return new KwpBizWalletVO();
        }
        KwpBizWalletVO walletVO = KwpBizWalletVO.getInstance();
        walletVO.setId(wallet.getId());
        walletVO.setSupEntId(wallet.getSupEntId());
        walletVO.setProEntId(wallet.getProEntId());
        walletVO.setName(wallet.getName());
        walletVO.setAmount(wallet.getAmount());
        walletVO.setPrepayAmount(wallet.getPrepayAmount());
        walletVO.setType(wallet.getType());
        walletVO.setState(wallet.getState());
        walletVO.setCreateTime(wallet.getCreateTime());
        walletVO.setUpdateTime(wallet.getUpdateTime());

        return walletVO;
    }


}
