package systemconfig

import "encoding/json"

const salePriceConfigKey = "listing.sale_price_config"

func defaultSalePriceConfigValue() string {
	raw, err := json.Marshal(DefaultSalePriceConfig())
	if err != nil {
		return "{}"
	}
	return string(raw)
}

func DefaultSalePriceConfig() PublishSalePriceConfig {
	return PublishSalePriceConfig{
		FixedMarkupRules: []PublishSaleFixedMarkupRule{
			{MinM: 10, MaxM: 30, MarkupAmount: 28},
			{MinM: 30, MaxM: 50, MarkupAmount: 31},
			{MinM: 50, MaxM: 70, MarkupAmount: 34},
			{MinM: 70, MaxM: 90, MarkupAmount: 38},
		},
		RatioAdjustmentRules: []PublishSaleRatioAdjustmentRule{
			{MinM: 90, MaxM: 150, RatioSubtract: 5},
			{MinM: 150, MaxM: 230, RatioSubtract: 4},
			{MinM: 230, MaxM: 310, RatioSubtract: 3.5},
			{MinM: 310, MaxM: 390, RatioSubtract: 3},
			{MinM: 390, MaxM: 470, RatioSubtract: 0},
			{MinM: 470, MaxM: 550, RatioSubtract: 0},
			{MinM: 550, RatioSubtract: 0},
		},
	}
}
