package com.yaoai.billing.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Data
@Configuration
@ConfigurationProperties(prefix = "billing")
public class BillingConfig {

    /** OFF / SOFT / STRICT */
    private String mode = "SOFT";

    private Map<String, BigDecimal> costs = new HashMap<>();

    public BigDecimal getCost(String operation) {
        return costs.getOrDefault(operation, BigDecimal.ZERO);
    }

    public boolean isOff()    { return "OFF".equalsIgnoreCase(mode); }
    public boolean isSoft()   { return "SOFT".equalsIgnoreCase(mode); }
    public boolean isStrict() { return "STRICT".equalsIgnoreCase(mode); }
}
