package api

import (
	"github.com/tech/sendico/pkg/vault/kv"
	mwa "github.com/tech/sendico/server/interface/middleware"
	fsc "github.com/tech/sendico/server/interface/services/fileservice/config"
)

type Config struct {
	Mw                  *mwa.Config                `yaml:"middleware"`
	Storage             *fsc.Config                `yaml:"storage"`
	ChainGateway        *ChainGatewayConfig        `yaml:"chain_gateway"`
	Ledger              *LedgerConfig              `yaml:"ledger"`
	PaymentOrchestrator *PaymentOrchestratorConfig `yaml:"payment_orchestrator"`
	PaymentQuotation    *PaymentOrchestratorConfig `yaml:"payment_quotation"`
	PaymentMethods      *PaymentOrchestratorConfig `yaml:"payment_methods"`
	Callbacks           *CallbacksConfig           `yaml:"callbacks"`
}

type ChainGatewayConfig struct {
	Address            string                  `yaml:"address"`
	AddressEnv         string                  `yaml:"address_env"`
	DialTimeoutSeconds int                     `yaml:"dial_timeout_seconds"`
	CallTimeoutSeconds int                     `yaml:"call_timeout_seconds"`
	Insecure           bool                    `yaml:"insecure"`
	DefaultAsset       ChainGatewayAssetConfig `yaml:"default_asset"`
}

type ChainGatewayAssetConfig struct {
	Chain           string `yaml:"chain"`
	TokenSymbol     string `yaml:"token_symbol"`
	ContractAddress string `yaml:"contract_address"`
}

type LedgerConfig struct {
	Address            string `yaml:"address"`
	AddressEnv         string `yaml:"address_env"`
	DialTimeoutSeconds int    `yaml:"dial_timeout_seconds"`
	CallTimeoutSeconds int    `yaml:"call_timeout_seconds"`
	Insecure           bool   `yaml:"insecure"`
}

type PaymentOrchestratorConfig struct {
	Address            string `yaml:"address"`
	AddressEnv         string `yaml:"address_env"`
	DialTimeoutSeconds int    `yaml:"dial_timeout_seconds"`
	CallTimeoutSeconds int    `yaml:"call_timeout_seconds"`
	Insecure           bool   `yaml:"insecure"`
}

type CallbacksConfig struct {
	DefaultEventTypes []string  `yaml:"default_event_types"`
	DefaultStatus     string    `yaml:"default_status"`
	SecretPathPrefix  string    `yaml:"secret_path_prefix"`
	SecretField       string    `yaml:"secret_field"`
	SecretLengthBytes int       `yaml:"secret_length_bytes"`
	Vault             kv.Config `yaml:"vault"`
}
