package com.fs.wx.dto;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderQueryRequest {

    /**
     * 聚合账户 (Required)
     */
    private String account;

    /**
     * 下游订单号 (Required if upOrderId is null)
     */
    private String lowOrderId;

    /**
     * 通莞订单号 (Required if lowOrderId is null)
     */
    private String upOrderId;

    /**
     * 值为"Y"时，接口返回优惠信息字段 (Optional)
     */
    private String extendInfo;

    /**
     * 值为"1"时，接口返回易宝专业版分账订单详情 (Optional)
     */
    private String isExtend;

    /**
     * 值为"1"时，接口返回SAAS分账订单详情 (Optional)
     */
    private String isNeedUpInfo;

    /**
     * 值为"1"时，接口返回渠道商户订单号字段 (Optional)
     */
    private String isNeedChannelMchOrderId;

    /**
     * 值为"1"时，返回因公付金额信息，仅支付宝服务商渠道支持 (Optional)
     */
    private String isNeedEnterprisePayInfo;

    /**
     * 签名 (Required)
     * Note: This will be calculated and set by the service.
     */
    private String sign;

    /**
     * Helper method to get parameters for signing.
     * Excludes the 'sign' field itself.
     * Returns sorted map to ensure consistent order for signing.
     *
     * @return A map of non-null parameters sorted by key.
     */
    public Map<String, String> toSignMap() {
       Map<String,String> sign = new HashMap<>();
        sign.put("account",account);
        sign.put("upOrderId",upOrderId);
        sign.put("isNeedUpInfo", isNeedUpInfo);
        return sign;
    }
}
