package gd_management

type DataApi struct {
	Id          int64  `json:"data_api_id" description:"数据api id"`
	DataApiName string `json:"data_api_name" description:"数据api名"`
	DataApiType int    `json:"data_api_type" description:"数据api类型"`
	DataApiDesc string `json:"data_api_desc" description:"数据API描述"`
	Version     string `json:"version" description:"数据api版本"`
	IsRelease   bool   `json:"is_release" description:"是否发布"`
	ReleaseTime string `json:"release_time" description:"发布时间"`
	CreateTime  string `json:"-"`
	UpdateTime  string `json:"-"`
}

type QueryType struct {
	Id              int64                      `json:"query_type_id" description:"数据api查询方式id"`
	DataApiId       int64                      `json:"data_api_id"  description:"数据api基础api"`
	IsFree          bool                       `json:"is_free" description:"数据api查询方式是否免费"`
	QueryTypeName   string                     `json:"query_type_name" description:"查询方式名"`
	CreateTime      string                     `json:"-"`
	UpdateTime      string                     `json:"-"`
	DataApiBaseApis []ManagementDataApiBaseApi `json:"data_api_base_apis" orm:"-" description:"数据api中基础api"`
	DayDataCombos   []DataCombo                `json:"day_data_combos" description:"按天套餐"`
	TotalDataCombos []DataCombo                `json:"total_data_combos" description:"总数套餐"`
	FreeDataCombos  []DataCombo                `json:"free_data_combos" description:"免费套餐"`
	UnitPrice       float64                    `json:"unit_price"`
	//DataCombos      []DataCombo                `json:"data_combos" orm:"-" description:"数据api中数据套餐"`

}

type ManagementDataApiBaseApi struct {
	Id          int64  `json:"data_api_base_api_id" description:"数据api中基础api id"`
	Priority    int    `json:"priority" description:"数据api中基础api 优先级"`
	ApiId       int64  `json:"api_id" description:"基础api id"`
	ApiName     string `json:"api_name" description:"基础api名"`
	SaleName    string `json:"sale_name" description:"销售名"`
	QueryTypeId int64  `json:"query_type_id" description:"查询方式id"`
	//ProviderApiList []BaseApiProviderItem    `json:"provider_api_list" orm:"-" description:""`
	ProviderGroupList []BaseApiProviderGroupItem `json:"provider_group_list" orm:"-" description:""`
	RequestParams     []ManagementBaseApiParam   `json:"request_params" description:"请求参数"`
	ResponseParams    []ManagementBaseApiParam   `json:"response_params" description:"响应参数"`
	RequestParam      string                     `json:"-" description:"请求参数json字符串"`
	ResponseParam     string                     `json:"-" description:"响应参数json字符串"`
	CountType         int                        `json:"count_type" description:"计数类型"`
	CountCode         string                     `json:"count_code" description:"计数码"`
	ForceUpdate       bool                       `json:"force_update" description:是否强更"`
	IsCrypto          bool                       `json:"is_crypto" description:"是否加密"`
	CreateTime        string                     `json:"-"`
	UpdateTime        string                     `json:"-"`
	ReuseTime         int                        `json:"reuse_time"`
	Filters           []BaseApiParamFilter       `json:"filters"`
	Router            string                     `json:"router"`
	ApiType           int                        `json:"api_type"`
}

type DataCombo struct {
	Id          int64   `json:"combo_id"  description:"查询方式套餐id"`
	QueryTypeId int64   `json:"query_type_id"  description:"查询方式id"`
	Count       int64   `json:"count"  description:"次数"`
	Price       float64 `json:"price"  description:"价格"`
	Type        int     `json:"type"  description:"计数类型"`
	TotalDay    int     `json:"total_day"  description:"总天数"`
	//IsFree      bool    `json:"is_free" description:"是否免费"`
	//CreateTime string `json:"-"`
	//UpdateTime string `json:"-"`
}

// 添加数据api
type ManagementDataApiAddApiReq struct {
	DataApiName string `json:"data_api_name" description:"数据api名"`
	DataApiType int    `json:"data_api_type" description:"数据api类型"`
	Version     string `json:"version" description:"版本"`
	DataApiDesc string `json:"data_api_desc"  description:"数据api描述"`
}

type ManagementDataApiAddApiReply struct {
	DataApiId int64 `json:"data_api_id" description:"数据api id"`
}

// 删除数据api
type ManagementDataApiDeleteApiReq struct {
	DataApiId int64 `json:"data_api_id"`
}

type ManagementDataApiDeleteApiReply struct {
}

// 修改数据api
type ManagementDataApiModifyApiReq struct {
	DataApiId   int64  `json:"data_api_id" description:"数据api id"`
	DataApiName string `json:"data_api_name" description:"数据api名"`
	DataApiType int    `json:"data_api_type" description:"数据api类型"`
	Version     string `json:"version" description:"数据api版本"`
	DataApiDesc string `json:"data_api_desc" description:"数据api描述"`
}
type ManagementDataApiModifyApiReply struct {
}

// 获取数据api列表
type ManagementDataApiGetAllReq struct {
	PageSize    int64  `json:"page_size"`
	PageNumber  int64  `json:"page_number" description:""`
	Search      string `json:"search"`
	IsAll       bool   `json:"is_all"`
	DataApiType string `json:"data_api_type" require:"false" in:"query"`
	MerchantId  int64  `json:"merchant_id"`
}

type ManagementDataApiGetAllReply struct {
	Total      int64     `json:"total" description:"总数据量"`
	PageSize   int64     `json:"page_size" description:"页大小"`
	PageNumber int64     `json:"page_number" description:"页号"`
	DataApis   []DataApi `json:"data_apis"`
}

// 获取数据api详情
type ManagementDataApiGetApiInfoReq struct {
	DataApiId int64 `json:"data_api_id"`
}
type ManagementDataApiGetApiInfoReply struct {
	QueryTypes []QueryType `json:"query_types" description:"查询方式列表"`
}

// 发布数据api
type ManagementDataApiReleaseApiReq struct {
	DataApiId int64 `json:"data_api_id"`
	Status    int   `json:"status"`
}

type ManagementDataApiReleaseApiReply struct {
}

// 添加数据api查询方式
type ManagementQueryTypeInfo struct {
	DataApiId     int64  `json:"data_api_id" description:"数据api id"`
	QueryTypeName string `json:"query_type_name" description:"数据api查询方式名"`
}

/*
type ManagementDataApiAddQueryTypeReq struct {
	QueryTypeInfos []ManagementQueryTypeInfo `json:"query_type_infos"`
}

type ManagementAddQueryType struct {
	DataApiQueryTypeId   int64  `json:"query_type_id" description:"数据api查询方式id"`
	DataApiQueryTypeName string `json:"query_type_name" description:"数据api查询方式名"`
}
type ManagementDataApiAddQueryTypeReply struct {
	ManagementAddQueryTypes []ManagementAddQueryType `json:"query_types"`
}
*/

type DataApiQueryTypeInfo struct {
	QueryTypeId   int64  `json:"query_type_id"`
	QueryTypeName string `json:"query_type_name" description:"数据api查询方式名"`
}

type ManagementDataApiAddQueryTypeReq struct {
	DataApiId  int64                  `json:"data_api_id" description:"数据api id"`
	QueryTypes []DataApiQueryTypeInfo `json:"query_types"`
}

type ManagementDataApiAddQueryTypeReply struct {
	QueryTypes []DataApiQueryTypeInfo `json:"query_types"`
}

// 修改数据api查询方式
type ManagementDataApiModifyQueryTypeReq struct {
	QueryTypeId   int64  `json:"query_type_id" description:"数据api查询方式id"`
	QueryTypeName string `json:"query_type_name" description:"数据api查询方式名"`
}
type ManagementDataApiModifyQueryTypeReply struct {
}

// 删除数据api查询方式
type ManagementDataApiRemoveQueryTypeReq struct {
	QueryTypeId int64 `json:"query_type_id"`
}
type ManagementDataApiRemoveQueryTypeReply struct {
}

// 获取数据api查询方式
type ManagementDataApiGetQueryTypeReq struct {
	QueryTypeId int64 `json:"query_type_id"`
}
type ManagementDataApiGetQueryTypeReply struct {
	QueryTypeInfo QueryType `json:"query_type_info" description:"查询方式信息"`
}

type ManagementDataApiAddBaseApi struct {
	ApiId int64 `json:"api_id"`
	//Priority int   `json:"priority"  description:"优先级"`
}

// 数据api添加基础api
type ManagementDataApiAddBaseApiReq struct {
	QueryTypeId           int64   `json:"query_type_id"`
	ManagementBaseApiList []int64 `json:"base_api_list"`
}

type ManagementDataApiAddBaseApiReply struct {
	//DataApiBaseApiId int64 `json:"data_api_base_api_id" description:"数据api中api id"`
}

// 数据api删除基础api
type ManagementDataApiRemoveBaseApiReq struct {
	DataApiBaseApiId int64 `json:"data_api_base_api_id"`
}
type ManagementDataApiRemoveBaseApiReply struct {
}

type ManagementProviderLimitGroup struct {
	GroupId           int                          `json:"group_id"`
	ProviderApiLimits []ManagementProviderApiLimit `json:"provider_api_limits"`
}

type BaseApiParamFilter struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	RuleId int64  `json:"rule_id"`
}

// 数据api修改基础api信息
type ManagementDataApiModifyBaseApiReq struct {
	DataApiBaseApiId  int64                      `json:"data_api_base_api_id" description:"数据api中基础api id"`
	ProviderApis      string                     `json:"-"`
	SaleName          string                     `json:"sale_name" description:"销售名"`
	ProviderGroupList []BaseApiProviderGroupItem `json:"provider_group_list"`
	//ProviderApiLimitGroup []ManagementProviderLimitGroup `json:"provider_api_limit_group" description:"三方api列表"`
	RequestParam  []ManagementBaseApiParam `json:"request_params" description:"请求参数"`
	ResponseParam []ManagementBaseApiParam `json:"response_params" description:"响应参数"`
	CountType     int                      `json:"count_type" description:"计数类型"`
	CountCode     string                   `json:"count_code" description:"计数码"`
	ForceUpdate   bool                     `json:"force_update" description:"是否开启强更"`
	IsCrypto      bool                     `json:"is_crypto" description:"是否加密"`
	ReuseTime     int                      `json:"reuse_time"`
	Filters       []BaseApiParamFilter     `json:"filters"`
}

type ManagementDataApiModifyBaseApiReply struct {
}

// 数据api获取基础api
type ManagementDataApiGetBaseApiReq struct {
	DataApiBaseApiId int64 `json:"data_api_base_api_id"`
}

type ManagementDataApiGetBaseApiReply struct {
	DataApiBaseApis ManagementDataApiBaseApi `json:"data_api_base_apis" orm:"-"`
}

// 数据api添加数据套餐
type ManagementDataCombo struct {
	ComboId     int64   `json:"combo_id"`
	QueryTypeId int64   `json:"query_type_id" description:"数据api查询方式id"`
	Count       int64   `json:"count" description:"次数"`
	Type        int     `json:"type" description:"1 总次数，2 按天"`
	TotalDay    int     `json:"total_day" description:"总天数"`
	Price       float64 `json:"price" description:"价格"`
	IsDelete    bool    `json:"is_delete"`
}

type ManagementDataApiAddDataComboReq struct {
	ManagementAddDataComboList []ManagementDataCombo `json:"management_add_data_combo_list"`
}
type ManagementDataApiAddDataComboReply struct {
	//ComboId int64 `json:"combo_id"`
}

// 数据api修改数据套餐
type ManagementDataApiModifyDataComboReq struct {
	ComboId int64 `json:"combo_id" description:"修改api查询方式套餐id"`
	Count   int64 `json:"count" description:"次数"`
	//Type     int     `json:"type"  description:"1 总次数，2 按天"`
	TotalDay int     `json:"total_day" description:"总天数"`
	Price    float64 `json:"price" description:"价格"`
	//IsFree   bool    `json:"is_free" description:"是否免费"`
}
type ManagementDataApiModifyDataComboReply struct {
}

// 数据api删除数据套餐
type ManagementDataApiRemoveDataComboReq struct {
	ComboId int64 `json:"combo_id"`
}
type ManagementDataApiRemoveDataComboReply struct {
}

// 获取数据api数据套餐
type ManagementDataApiGetDataComboReq struct {
	ComboId int64 `json:"combo_id"`
}
type ManagementDataApiGetDataComboReply struct {
	Count         int     `json:"count"`
	Price         float64 `json:"price"`
	Type          int     `json:"type"`
	TotalDay      int     `json:"total_day"`
	QueryTypeName string  `json:"query_type_name"`
}

// 数据api选择三方数据源接口

type ManagementProviderApiLimit struct {
	ThirdpartApiId     int64  `json:"thirdpart_api_id" description:"三方api id"`
	PlatformName       string `json:"platform_name" description:"三方平台名"`
	ThirdpartApiName   string `json:"thirdpart_api_name" description:"三方api名称"`
	PlatformCode       string `json:"platform_code" description:"三方平台码"`
	ThirdpartApiRouter string `json:"thirdpart_api_router" description:"三方api路由"`
	ThirdpartApiMethod string `json:"thirdpart_api_method" description:"三方api方法"`
	Enable             bool   `json:"enable" description:"是否启用"`
	DayCount           int    `json:"day_count" description:"每日调用量限额"`
	Count              int    `json:"count" description:"总调用量限额"`
}

// 获取数据api查询方式
type ManagementDataApiQueryTypeList struct {
	QueryTypeId   int64  `json:"query_type_id"`
	QueryTypeName string `json:"query_type_name"`
}
type ManagementDataApiGetQueryTypeListReq struct {
	DataApiId int64 `json:"data_api_id"`
}
type ManagementDataApiGetQueryTypeListReply struct {
	ManagementDataApiQueryTypeList []ManagementDataApiQueryTypeList `json:"query_type_list"`
}

// 设置查询方式数据套餐
type ManagementDataApiSetFreeDataComboReq struct {
	QueryTypeId            int64   `json:"query_type_id"`
	DataApiQueryTypeIsFree bool    `json:"is_free"`
	Count                  int64   `json:"count"`
	UnitPrice              float64 `json:"unit_price"`
}
type ManagementDataApiSetFreeDataComboReply struct {
}

type ManagementQueryTypeBaseApi struct {
	Priority         int    `json:"priority" description:"优先级"`
	DataApiBaseApiId int64  `json:"data_api_base_api_id" description:"数据api中基础api id"`
	ApiId            int64  `json:"api_id"`
	ApiName          string `json:"api_name"`
	SaleName         string `json:"sale_name"`
	ApiType          int    `json:"api_type"`
	Router           string `json:"router"`
}
type ManagementQueryTypeBaseApiListReq struct {
	QueryTypeId int64 `json:"query_type_id"`
}

type ManagementQueryTypeBaseApiListReply struct {
	ManagementQueryTypeBaseApiList []ManagementQueryTypeBaseApi `json:"management_query_type_base_api_list"`
}

type ManagementDataApiComboListReq struct {
	QueryTypeId int64 `json:"query_type_id"`
}
type DataApiComboListItem struct {
	ComboId   int64  `json:"combo_id"`
	ComboDesc string `json:"combo_desc" description:"套餐描述"` // desc 改为 combodesc
	ComboType int    `json:"combo_type" description:"套餐类型"`
	Count     int    `json:"count"`
}

type ManagementDataApiComboListReply struct {
	//ComboList []string `json:"combo_list"`
	ComboList []DataApiComboListItem `json:"combo_list"`
}

type GetApiInfoReq struct {
	Id int64 `json:"id"`
}

type GetApiInfoReply struct {
	DataApiName string `json:"data_api_name" description:"数据api名"`
	DataApiType int    `json:"data_api_type" description:"数据api类型"`
	DataApiDesc string `json:"data_api_desc" description:"数据API描述"`
	Version     string `json:"version" description:"数据api版本"`
	IsRelease   bool   `json:"is_release" description:"是否发布"`
}
