package param_v1_0

import (
	"gd_management_gateway/params/param_base"
	"gd_management_gateway/rpc_apis/gd_management"
)

type ManagementAddBaseApiReq struct {
	param_base.BasicParam
	BaseApiInfo gd_management.ManagementBaseApiInfo `json:"base_api_info" description:"" require:"true" in:"body"`
}

type ManagementAddBaseApiResp struct {
	param_base.SimpleResp
	Data gd_management.ManagementAddBaseApiReply `json:"data"`
}

type ManagementDelBaseApiReq struct {
	param_base.BasicParam
	ApiId int64 `json:"api_id" description:"" in:"query"`
}

type ManagementDelBaseApiResp struct {
	param_base.SimpleResp
}

type ManagementUpdateBaseApiReq struct {
	param_base.BasicParam
	ApiId       int64                                `json:"api_id" description:"api id" in:"path"`
	BaseApiInfo gd_management.ManagementBaseApiInfo `json:"base_api_info" description:"" in:"body"`
}

type ManagementUpdateBaseApiResp struct {
	param_base.SimpleResp
}

type ManagementGetBaseApiListReq struct {
	param_base.BasicParam
	ApiType    int    `json:"api_type" description:"api类型" require:"false" in:"query"`
	PageNumber int    `json:"page_number" description:"当前页" require:"false"  in:"query"`
	Search     string `json:"search" require:"false"  in:"query"`
	IsAll      bool   `json:"is_all"  descrition:"是否全量返回" require:"false" in:"query"`
	MerchantId int64  `json:"merchant_id" require:"false" in:"query"`
}

type ManagementGetBaseApiListResp struct {
	param_base.SimpleResp
	Data gd_management.ManagementGetBaseApiListReply `json:"data"`
}

type ManagementGetBaseApiInfoReq struct {
	param_base.BasicParam
	ApiId int64 `json:"api_id" description:"api id" in:"query"`
}

type ManagementGetBaseApiInfoResp struct {
	param_base.SimpleResp
	Data gd_management.ManagementBaseApiInfo `json:"data" description:""`
}

//api停启用
type ManagementSetBaseApiStateBody struct {
	Enable bool `json:"enable" description:"是否启用"`
}

type ManagementSetBaseApiStateReq struct {
	param_base.BasicParam
	Body  ManagementSetBaseApiStateBody `json:"body" in:"body" require:"true"`
	ApiId int64                         `json:"api_id" description:"api id" in:"path"`
}

type ManagementSetBaseApiStateResp struct {
	param_base.SimpleResp
}

//api 与数据源
type ManagementAddBaseApiProviderReq struct {
	param_base.BasicParam
	Providers gd_management.ManagementAddBaseApiProviderReq `json:"providers" description:"所有数据源信息" in:"query"`
}

type ManagementAddBaseApiProviderResp struct {
	param_base.SimpleResp
}

type ManagementDelBaseApiProviderReq struct {
	param_base.BasicParam
	ApiId         int64 `json:"api_id" description:"基础api id" in:"query"`
	GroupNumber   int   `json:"group_number" description:"组号" in:"query"`
	ProviderApiId int64 `json:"provider_api_id" description:"数据源api id" in:"query"`
}

type ManagementDelBaseApiProviderResp struct {
	param_base.SimpleResp
}

type ManagementGetBaseApiProviderListReq struct {
	param_base.BasicParam
	ApiId int64 `json:"api_id" description:"基础api id" in:"query"`
	//PageNumber int64 `json:"page_number" description:"当前页"`
}

type ManagementGetBaseApiProviderListResp struct {
	//Total      int                    `json:"" description:""`
	//PageSize   int                    `json:"" description:""`
	//PageNumber int                    `json:"" description:""`
	param_base.SimpleResp
	Data []gd_management.BaseApiProviderGroupItem `json:"data" description:""`
}

/*type ManagementSetBaseApiProviderPriorityReq struct {
	param_base.BasicParam
	ApiId          int64  `json:"api_id" description:"基础api id" in:"query"`
	GroupNumber    int    `json:"group_number" description:"组号" in:"query"`
	ProviderApiIds string `json:"provider_api_ids" description:"数据源api id 按优先级排序后列表,以逗号分隔" in:"query"`
}

type ManagementSetBaseApiProviderPriorityResp struct {
	param_base.SimpleResp
}
*/

type ManagementSetBaseApiThresholdBody struct {
	ThresholdTimeout      int     `json:"threshold_timeout"`
	ThresholdFailRate     float64 `json:"threshold_fail_rate"`
	ThresholdNorecordRate float64 `json:"threshold_norecord_rate"`
	WarningEnable         bool    `json:"warning_enable"`
	RateLimit             int     `json:"rate_limit" description:"并发限制"`
}

type ManagementSetBaseApiThresholdReq struct {
	param_base.BasicParam
	ApiId int64                             `json:"api_id" in:"path" require:"true"`
	Body  ManagementSetBaseApiThresholdBody `json:"body" in:"body" require:"true"`
}

type ManagementSetBaseApiThresholdResp struct {
	param_base.SimpleResp
}

type ManagementBaseApiShowInfo struct {
	IsShow bool `json:"is_show"`
}

type ManagementSetBaseApiShowInfoReq struct {
	param_base.BasicParam
	ApiId           int64                     `json:"api_id" description:"api id" in:"path"`
	BaseApiShowInfo ManagementBaseApiShowInfo `json:"base_api_show_info" description:"" in:"body"`
}

type ManagementSetBaseApiShowInfoResp struct {
	param_base.SimpleResp
}

type ManagementGetBaseApiParamTypeListReq struct {
	param_base.BasicParam
}

type ManagementGetBaseApiParamTypeListResp struct {
	param_base.SimpleResp
	TypeList []string `json:"type_list"`
}

type ManagementGetFilterRuleReq struct {
	param_base.BasicParam
}

type ManagementGetFilterRuleResp struct {
	param_base.SimpleResp
	Rules []gd_management.FilterRule `json:"rules"`
}
