package com.sckw.payment.repose;


import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sckw.payment.model.KwpBizWalletPrepay;
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 KwpBizWalletPrepayPageResponse {

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

    /**
     * 钱包id
     */
    @Schema(description = "钱包id")
    private Long walletId;

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

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

    /**
     * 订单id
     */
    @Schema(description = "订单id")
    private Long orderId;

    /**
     * 变动金额（单位：元，保留5位小数）
     */
    @Schema(description = "本次更新金额")
    private BigDecimal changeAmount;

    /**
     * 可用金额
     */
    @Schema(description = "可用金额")
    private BigDecimal amount;

    /**
     * 冻结金额
     */
    @Schema(description = "冻结金额")
    private BigDecimal prepayAmount;

    /**
     * 动帐类型  0-预付、1-扣款、2-冻结、3-解冻、4-消费
     */
    @Schema(description = "动帐类型  0-预付、1-扣款、2-冻结、3-解冻、4-消费")
    private Integer type;

    /**
     * 凭证URL地址
     */
    @Schema(description = "凭证URL地址")
    private String voucherUrl;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

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

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

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

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


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


    public static KwpBizWalletPrepayPageResponse toPageResp(KwpBizWalletPrepay walletPrepay) {
        if (walletPrepay == null) {
            return new KwpBizWalletPrepayPageResponse();
        }

        KwpBizWalletPrepayPageResponse walletPrepayResponse = KwpBizWalletPrepayPageResponse.getInstance();
        walletPrepayResponse.setId(walletPrepay.getId());
        walletPrepayResponse.setWalletId(walletPrepay.getWalletId());
        walletPrepayResponse.setOrderId(walletPrepay.getOrderId());
        walletPrepayResponse.setChangeAmount(walletPrepay.getChangeAmount());
        walletPrepayResponse.setAmount(walletPrepay.getAmount());
        walletPrepayResponse.setPrepayAmount(walletPrepay.getPrepayAmount());
        walletPrepayResponse.setType(walletPrepay.getType());
        walletPrepayResponse.setVoucherUrl(walletPrepay.getVoucherUrl());
        walletPrepayResponse.setRemark(walletPrepay.getRemark());
        walletPrepayResponse.setCreateTime(walletPrepay.getCreateTime());
        walletPrepayResponse.setUpdateTime(walletPrepay.getUpdateTime());
        walletPrepayResponse.setCreateUser(walletPrepayResponse.getCreateUser());
        walletPrepayResponse.setUpdateUser(walletPrepayResponse.getUpdateUser());

        return walletPrepayResponse;
    }




}
