package com.kym.service.wechat.impl;


import com.kym.entity.WashOrder;
import com.kym.service.cache.KymCache;
import com.kym.service.wechat.TemplateParamBuilder;

import java.util.Map;

/**
 * 订单消费达标领取优惠券消息参数构建
 */
public class ParkingCouponParamBuilder implements TemplateParamBuilder {

    private static final String ORDER_ID = "character_string12";
    private static final String ORDER_AMOUNT = "amount3";
    private static final String STATION_NAME = "thing15";
    private static final String SERVICE_NAME = "thing2";

    @Override
    public Map<String, String> buildParams(Object... args) {
        if (args.length < 1 || !(args[0] instanceof WashOrder washOrder)) {
            throw new IllegalArgumentException("需要传入有效的参数");
        }
        return Map.of(
                ORDER_ID, washOrder.getOrderId(),
                STATION_NAME, KymCache.INSTANCE.getStationNameById(washOrder.getStationId()),
                ORDER_AMOUNT, formatAmount(washOrder.getAmountReceived()),
                SERVICE_NAME, "消费已达标，【点击本消息】领取停车优惠券"
        );
    }
}
