syntax = "v1"

info (
	title:   "System API"
	desc:    "API for ppanel"
	author:  "Tension"
	email:   "tension@ppanel.com"
	version: "0.0.1"
)

import "../types.api"

type (
	GetNodeMultiplierResponse {
		Periods []TimePeriod `json:"periods"`
	}
	// SetNodeMultiplierRequest
	SetNodeMultiplierRequest {
		Periods []TimePeriod `json:"periods"`
	}
	PreViewNodeMultiplierResponse {
		CurrentTime string  `json:"current_time"`
		Ratio       float32 `json:"ratio"`
	}
	ModuleConfig {
		Secret         string `json:"secret"` // 通讯密钥
		ServiceName    string `json:"service_name"` // 服务名称
		ServiceVersion string `json:"service_version"` // 服务版本
	}
)

@server (
	prefix:     v1/admin/system
	group:      admin/system
	middleware: AuthMiddleware
)
service ppanel {
	@doc "Get site config"
	@handler GetSiteConfig
	get /site_config returns (SiteConfig)

	@doc "Update site config"
	@handler UpdateSiteConfig
	put /site_config (SiteConfig)

	@doc "Get subscribe config"
	@handler GetSubscribeConfig
	get /subscribe_config returns (SubscribeConfig)

	@doc "Update subscribe config"
	@handler UpdateSubscribeConfig
	put /subscribe_config (SubscribeConfig)

	@doc "Get register config"
	@handler GetRegisterConfig
	get /register_config returns (RegisterConfig)

	@doc "Update register config"
	@handler UpdateRegisterConfig
	put /register_config (RegisterConfig)

	@doc "Get verify config"
	@handler GetVerifyConfig
	get /verify_config returns (VerifyConfig)

	@doc "Update verify config"
	@handler UpdateVerifyConfig
	put /verify_config (VerifyConfig)

	@doc "Get node config"
	@handler GetNodeConfig
	get /node_config returns (NodeConfig)

	@doc "Update node config"
	@handler UpdateNodeConfig
	put /node_config (NodeConfig)

	@doc "Get invite config"
	@handler GetInviteConfig
	get /invite_config returns (InviteConfig)

	@doc "Update invite config"
	@handler UpdateInviteConfig
	put /invite_config (InviteConfig)

	@doc "Get Team of Service Config"
	@handler GetTosConfig
	get /tos_config returns (TosConfig)

	@doc "Update Team of Service Config"
	@handler UpdateTosConfig
	put /tos_config (TosConfig)

	@doc "get Privacy Policy Config"
	@handler GetPrivacyPolicyConfig
	get /privacy returns (PrivacyPolicyConfig)

	@doc "Update Privacy Policy Config"
	@handler UpdatePrivacyPolicyConfig
	put /privacy (PrivacyPolicyConfig)

	@doc "Get Currency Config"
	@handler GetCurrencyConfig
	get /currency_config returns (CurrencyConfig)

	@doc "Update Currency Config"
	@handler UpdateCurrencyConfig
	put /currency_config (CurrencyConfig)

	@doc "setting telegram bot"
	@handler SettingTelegramBot
	post /setting_telegram_bot

	@doc "Get Node Multiplier"
	@handler GetNodeMultiplier
	get /get_node_multiplier returns (GetNodeMultiplierResponse)

	@doc "Set Node Multiplier"
	@handler SetNodeMultiplier
	post /set_node_multiplier (SetNodeMultiplierRequest)

	@doc "Get Verify Code Config"
	@handler GetVerifyCodeConfig
	get /verify_code_config returns (VerifyCodeConfig)

	@doc "Update Verify Code Config"
	@handler UpdateVerifyCodeConfig
	put /verify_code_config (VerifyCodeConfig)

	@doc "PreView Node Multiplier"
	@handler PreViewNodeMultiplier
	get /node_multiplier/preview returns (PreViewNodeMultiplierResponse)

	@doc "Get Module Config"
	@handler GetModuleConfig
	get /module returns (ModuleConfig)
}

