package gd_statistics

type AccessLog struct {
	Id                int64   `json:"id"`
	MerchantId        int64   `json:"-"`
	ApiId             int64   `json:"-"`
	MerchantName      string  `json:"merchant_name"`
	ApiName           string  `json:"api_name"`
	RequestParams     string  `json:"request_params"`
	ResponseParams    string  `json:"origin_response"`
	RawRequestParams  string  `json:"origin_request"`
	RawResponseParams string  `json:"response_params"`
	RawCode           int     `json:"raw_code"`
	Code              int     `json:"code"`
	Msg               string  `json:"msg"`
	IsReuse           bool    `json:"is_reuse"`
	State             bool    `json:"state"`
	RemoteAddr        string  `json:"remote_addr"`
	Elapsed           float64 `json:"elapsed"`
	Search            string  `json:"search"`
	Timestamp         int64   `json:"timestamp"`
	ProviderCount     int     `json:"provider_count"`
	UtSource          string  `json:"ut_source"`
	CreateTime        string  `json:"create_time"`
	RawSearch string `json:"raw_search"`
}

type ThirdpartLog struct {
	Id              int64   `json:"id"`
	MerchantId      int64   `json:"-"`
	ApiId           int64   `json:"-"`
	ProviderId      string  `json:"-"`
	ProviderApiId   string  `json:"-"`
	MerchantName    string  `json:"merchant_name"`
	ApiName         string  `json:"api_name"`
	ProviderName    string  `json:"provider_name"`
	ProviderApiName string  `json:"provider_api_name"`
	RequestParams   string  `json:"request_params"`
	ResponseParams  string  `json:"response_params"`
	RawCode         string  `json:"raw_code"`
	Code            int     `json:"code"`
	Msg             string  `json:"msg"`
	State           bool    `json:"state"`
	RemoteAddr      string  `json:"remote_addr"`
	Elapsed         float64 `json:"elapsed"`
	Timestamp       int64   `json:"-"`
	CreateTime      string  `json:"create_time"`
	Search          string  `json:"search"`
}
type LogAddAccessLogReq struct {
	ThirdpartLogId int64
	MerchantId     int64   `json:"merchant_id"`
	ApiId          int64   `json:"api_id"`
	MerchantName   string  `json:"merchant_name"`
	ApiName        string  `json:"api_name"`
	PlateNo        string  `json:"plate_no"`
	PlateType      string  `json:"plate_type"`
	Vin            string  `json:"vin"`
	RequstParams   string  `json:"requst_params"`
	ResponseParams string  `json:"response_params"`
	Code           int     `json:"code"`
	Msg            string  `json:"msg"`
	IsReuse        bool    `json:"is_reuse"`
	State          bool    `json:"state"`
	RemoteAddr     string  `json:"remote_addr"`
	Elapsed        float64 `json:"elapsed"`
}

type LogAddAccessLogReply struct {
}

type LogAddThirdpartLogReq struct {
	MerchantId      int64   `json:"merchant_id"`
	ApiId           int64   `json:"api_id"`
	ProviderId      string  `json:"provider_id"`
	ProviderApiId   string  `json:"provider_api_id"`
	MerchantName    string  `json:"merchant_name"`
	ApiName         string  `json:"api_name"`
	ProviderName    string  `json:"provider_name"`
	ProviderApiName string  `json:"provider_api_name"`
	RequstParams    string  `json:"requst_params"`
	ResponseParams  string  `json:"response_params"`
	Code            int     `json:"code"`
	Msg             string  `json:"msg"`
	State           bool    `json:"state"`
	RemoteAddr      string  `json:"remote_addr"`
	Elapsed         float64 `json:"elapsed"`
}

type LogAddThirdpartLogReply struct {
}

type LogQueryAccessLogReq struct {
	/*Vin            string `json:"vin"`
	PlateNo        string `json:"plate_no"`
	MerchantId     int64  `json:"merchant_id"`
	ApiId          int64  `json:"api_id"`
	MerchantName   string `json:"merchant_name"`
	ApiName        string `json:"api_name"`
	StartTimestamp int64  `json:"start_timestamp"`
	EndTimestamp   int64  `json:"end_timestamp"`
	PageSize       int64  `json:"page_size"`
	PageNumber     int64  `json:"page_number"`*/
	MerchantId     int64   `json:"merchant_id"`
	ApiId          int64   `json:"api_id"`
	RequestParam   string  `json:"request_param"`
	Search         string  `json:"search"`
	State          int     `json:"state"`
	StartTimestamp int64   `json:"start_timestamp"`
	EndTimestamp   int64   `json:"end_timestamp"`
	PageSize       int64   `json:"page_size"`
	PageNumber     int64   `json:"page_number"`
	Code           string  `json:"code"`
	Min            float64 `json:"min"`
	Max            float64 `json:"max"`
	LastId         int64 `json:"last_id"`
	UseId     bool `json:"use_id"`
}

type LogQueryAccessLogReply struct {
	PageSize   int64       `json:"page_size"`
	PageNumber int64       `json:"page_number"`
	Total      int64       `json:"total"`
	AccessLogs []AccessLog `json:"access_logs"`
}

type LogQueryThirdpartAccessLogReq struct {
	Search         string  `json:"search"`
	RequestParam   string  `json:"request_param"`
	State          int     `json:"state"`
	ProviderId     int64   `json:"provider_id"`
	ProviderApiId  int64   `json:"provider_api_id"`
	StartTimestamp int64   `json:"start_timestamp"`
	EndTimestamp   int64   `json:"end_timestamp"`
	PageSize       int64   `json:"page_size"`
	PageNumber     int64   `json:"page_number"`
	Min            float64 `json:"min"`
	Max            float64 `json:"max"`
	RawCode        string  `json:"raw_code"`
}

type LogQueryThirdpartAccessLogReply struct {
	PageSize      int64          `json:"page_size"`
	PageNumber    int64          `json:"page_number"`
	Total         int64          `json:"total"`
	ThirdpartLogs []ThirdpartLog `json:"thirdpart_logs"`
}

type LogQueryAccessLogCountReq struct {
	MerchantId     int64 `json:"merchant_id"`
	ApiId          int64 `json:"api_id"`
	StartTimestamp int64 `json:"start_timestamp"`
	EndTimestamp   int64 `json:"end_timestamp"`
	PageSize       int64 `json:"page_size"`
	PageNumber     int64 `json:"page_number"`
}

type QueryAccessLogCount struct {
	Date         string  `json:"date"`
	MerchantName string  `json:"merchant_name"`
	ApiName      string  `json:"api_name"`
	Total        int64   `json:"total"`
	Success      int64   `json:"success"`
	Reuse        int64   `json:"reuse"`
	Elapsed      float64 `json:"elapsed"`
	Failed       int64   `json:"failed"`
	SuccessRate  string  `json:"success_rate"`
	ReuseRate    string  `json:"reuse_rate"`
}

type LogQueryAccessLogCountReply struct {
	PageSize             int64                 `json:"page_size"`
	PageNumber           int64                 `json:"page_number"`
	Total                int64                 `json:"total"`
	QueryAccessLogCounts []QueryAccessLogCount `json:"query_access_log_counts"`
}

type QueryThirdpartAccessLogCount struct {
	Date            string  `json:"date"`
	ProviderName    string  `json:"provider_name"`
	ProviderApiName string  `json:"provider_api_name"`
	Total           int64   `json:"total"`
	Success         int64   `json:"success"`
	Elapsed         float64 `json:"elapsed"`
	Failed          int64   `json:"failed"`
	SuccessRate     string  `json:"success_rate"`
}
type LogQueryThirdpartAccessLogCountReq struct {
	ProviderId     int64 `json:"provider_id"`
	ProviderApiId  int64 `json:"provider_api_id"`
	StartTimestamp int64 `json:"start_timestamp"`
	EndTimestamp   int64 `json:"end_timestamp"`
	PageSize       int64 `json:"page_size"`
	PageNumber     int64 `json:"page_number"`
}

type LogQueryThirdpartAccessLogCountReply struct {
	PageSize                      int64                          `json:"page_size"`
	PageNumber                    int64                          `json:"page_number"`
	Total                         int64                          `json:"total"`
	QueryThirdpartAccessLogCounts []QueryThirdpartAccessLogCount `json:"query_thirdpart_access_log_count"`
}

type LogQueryAccessLogThirdpartLogReq struct {
	AccessId  int64 `json:"access_id"`
	Timestamp int64 `json:"timestamp"`
}

type LogQueryAccessLogThirdpartLogReply struct {
	ThirdpartLogs []ThirdpartLog `json:"thirdpart_logs"`
}

type LogAddInvalidAccessLogReq struct {
	MerchantId    int64   `json:"merchant_id"`
	ApiId         int64   `json:"api_id"`
	RemoteAddr    string  `json:"remote_addr"`
	TimeStamp     int64   `json:"time_stamp"`
	Code          int     `json:"code"`
	Msg           string  `json:"msg"`
	RequestParams string  `json:"request_params"`
	Elapsed       float64 `json:"elapsed"`
}

type LogAddInvalidAccessLogReply struct {
}

// 访问接口统计详情
type LogQueryInterfaceCountReq struct {
	ApiId          int64 `json:"api_id"`
	MerchantId     int64 `json:"merchant_id"`
	StartTimestamp int64 `json:"start_timestamp"`
	EndTimestamp   int64 `json:"end_timestamp"`
	Option         int   `json:"option"`
}

type LogQuerySuccessCount struct {
	Reuse   int64 `json:"reuse"`
	Query   int64 `json:"query"`
	UnQuery int64 `json:"un_query"`
}

type LogQueryFailCount struct {
	ProviderFail int64 `json:"provider_fail"`
	ServiceFail  int64 `json:"service_fail"`
}

type LogQueryInvalidCount struct {
	ParamError       int64 `json:"param_error"`
	ParamFormatError int64 `json:"param_format_error"`
}

type LogQueryInterfaceCountReply struct {
	Total                int64                `json:"total"`
	SuccessRate          float64              `json:"success_rate"`
	FailRate             float64              `json:"fail_rate"`
	ReuseRate            float64              `json:"reuse_rate"`
	QueryRate            float64              `json:"query_rate"`
	UnQueryRate          float64              `json:"un_query_rate"`
	ProviderFailRate     float64              `json:"provider_fail_rate"`
	ServiceFailRate      float64              `json:"service_fail_rate"`
	LogQuerySuccessCount LogQuerySuccessCount `json:"log_query_success_count"`
	LogQueryFailCount    LogQueryFailCount    `json:"log_query_fail_count"`
	LogQueryInvalidCount LogQueryInvalidCount `json:"log_query_invalid_count"`
}

type LogQueryUserAccessCountReq struct {
	ApiId          int64 `json:"api_id"`
	MerchantId     int64 `json:"merchant_id"`
	StartTimestamp int64 `json:"start_timestamp"`
	EndTimestamp   int64 `json:"end_timestamp"`
	PageSize       int64 `json:"page_size"`
	PageNumber     int64 `json:"page_number"`
}

type LogQueryUserAcessCount struct {
	Date        string  `json:"date" description:"时间"`
	ApiName     string  `json:"api_name" description:"接口名"`
	Total       int64   `json:"total" description:"总量"`
	Valid       int64   `json:"valid" description:"有效量"`
	Success     int64   `json:"success" description:"成功量"`
	Query       int64   `json:"query" description:"查得量"`
	Reuse       int64   `json:"reuse" description:"复用量"`
	ValidRate   string  `json:"valid_rate" description:"有效率"`
	SuccessRate string  `json:"success_rate" description:"成功率"`
	QueryRate   string  `json:"query_rate" description:"查得率"`
	ReuseRate   string  `json:"reuse_rate" description:"复用率"`
	Elapsed     float64 `json:"elapsed" description:"平均耗时"`
	Charge      int64   `json:"charge" description:"计费数"`
	ChargeRate  string  `json:"charge_rate" description:"计费率"`
}

type LogQueryUserAccessCountReply struct {
	PageSize               int64                    `json:"page_size"`
	PageNumber             int64                    `json:"page_number"`
	Total                  int64                    `json:"total"`
	LogQueryUserAcessCount []LogQueryUserAcessCount `json:"log_query_user_access_count"`
}

type LogQueryUserAccessCountExportReq struct {
	ExportName     string  `json:"export_name"`
	ApiIdList      []int64 `json:"api_id_list"`
	MerchantId     int64   `json:"merchant_id"`
	StartTimestamp int64   `json:"start_timestamp"`
	EndTimestamp   int64   `json:"end_timestamp"`
	TimeList       string  `json:"time_list"`
}
type LogQueryUserAcessCountExport struct {
	Date                 string  `json:"date"`
	ApiName              string  `json:"api_name"`
	Total                int     `json:"total"`
	Valid                int     `json:"valid"`
	Success              int     `json:"success"`
	Query                int     `json:"query"`
	Reuse                int     `json:"reuse"`
	ValidRate            string  `json:"valid_rate"`
	SuccessRate          string  `json:"success_rate"`
	QueryRate            string  `json:"query_rate"`
	ReuseRate            string  `json:"reuse_rate"`
	AvgElapsed           float64 `json:"avg_elapsed"`
	SumElapsed           float64 `json:"sum_elapsed"`
	PlatformError        int     `json:"platform_error"`
	PlatformErrorRate    string  `json:"platform_error_rate"`
	ProviderError        int     `json:"provider_error"`
	ProviderErrorRate    string  `json:"provider_error_rate"`
	BigElapsedList       []int   `json:"big_elapsed_list"`
	ChargeBigElapsedList []int   `json:"charge_big_elapsed_list"`
	Charge               int     `json:"charge"`
	ChargeRate           string  `json:"charge_rate"`
}

type SourceNameCount struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
	Rate  string `json:"rate"`
}

type SourceExport struct {
	ApiName   string            `json:"api_name"`
	Date      string            `json:"date"`
	Providers string            `json:"providers"`
	Total     int               `json:"total"`
	Sources   []SourceNameCount `json:"sources"`
}

type ErrorCodeCount struct {
	Code  string
	Count int
	Rate  string
}

type ErrorExport struct {
	ApiName string           `json:"api_name"`
	Codes   string           `json:"codes"`
	Total   int              `json:"total"`
	Date    string           `json:"date"`
	Errors  []ErrorCodeCount `json:"errors"`
}

type LogQueryUserAccessCountExportReply struct {
	LogQueryUserAcessCount []LogQueryUserAcessCountExport
	SourceCount            []SourceExport
	ErrorCount             []ErrorExport
}

type LogQueryThirdpartAccessCountReq struct {
	ProviderApiId  int64  `json:"provider_api_id"`
	Time           string `json:"time"`
	StartTimestamp int64  `json:"start_timestamp"`
	EndTimestamp   int64  `json:"end_timestamp"`
}

type LogQueryThirdpartAccessCountReply struct {
	Total     int64 `json:"total" description:"总用量"`
	UseCount  int64 `json:"use_count" description:"已用量"`
	LeftCount int64 `json:"left_count" description:"剩余用量"`
}

type LogQueryThirdpartInterfaceCountReq struct {
	ProviderApiId  int64 `json:"provider_api_id"`
	StartTimestamp int64 `json:"start_timestamp"`
	EndTimestamp   int64 `json:"end_timestamp"`
	PageSize       int64 `json:"page_size"`
	PageNumber     int64 `json:"page_number"`
}

type LogQueryThirdpartInterfaceCount struct {
	Date            string `json:"date" description:"时间"`
	ProviderApiName string `json:"provider_api_name" description:"供应商api名"`
	ProviderName    string `json:"provider_name" description:"供应商名"`
	Total           int64  `json:"total" description:"调用总量"`
	Success         int64  `json:"success" description:"成功量"`
	Fail            int64  `json:"fail" description:"失败量"`
	Query           int64  `json:"query" description:"查得量"`
	UnQuery         int64  `json:"un_query" description:"查无量"`
	FailRate        string `json:"fail_rate" description:"失败率"`
	QueryRate       string `json:"query_rate" description:"查得率"`
}

type LogQueryThirdpartInterfaceCountReply struct {
	PageSize                        int64                             `json:"page_size"`
	PageNumber                      int64                             `json:"page_number"`
	Total                           int64                             `json:"total"`
	LogQueryThirdpartInterfaceCount []LogQueryThirdpartInterfaceCount `json:"log_query_thirdpart_interface_count"`
}

type TGdAccessLogCountExport struct {
	Id         int64  `json:"id"`
	FileName   string `json:"file_name"`
	Path       string `json:"path"`
	Status     string `json:"status"`
	CreateTime string `json:"create_time"`
	StatusCode int    `json:"status_code"`
}

type LogQueryProviderCountExportReq struct {
	ExportName        string  `json:"export_name"`
	ProviderApiIdList []int64 `json:"provider_api_id_list"`
	ProviderId        int64   `json:"provider_id"`
	StartTimestamp    int64   `json:"start_timestamp"`
	EndTimestamp      int64   `json:"end_timestamp"`
	TimeList          string  `json:"time_list"`
}

type LogQueryProviderCountExportReply struct {
	LogQueryProviderCount []LogQueryProviderCountExport
}

type LogQueryProviderCountExport struct {
	Date                 string  `json:"date"`
	ProviderName         string  `json:"provider_name"`
	ProviderApiName      string  `json:"provider_api_name"`
	Total                int64   `json:"total"`
	Success              int64   `json:"success"`
	Failed               int64   `json:"failed"`
	FailedRate           string  `json:"failed_rate"`
	Query                int64   `json:"query"`
	QueryNoRecord        int64   `json:"query_no_record"`
	QueryNoRecordRate    string  `json:"query_no_record_rate"`
	AvgElapsed           float64 `json:"avg_elapsed"`
	SumElapsed           float64 `json:"sum_elapsed"`
	BigElapsedList       []int   `json:"big_elapsed_list"`
	ChargeBigElapsedList []int   `json:"charge_big_elapsed_list"`
}

type LogExportCreateReq struct {
	Id         int64  `json:"id"`
	FileName   string `json:"file_name"`
	Path       string `json:"path"`
	Status     string `json:"status"`
	ExportType int    `json:"export_type"`
}

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

type LogExportListReq struct {
	PageNumber int64 `json:"page_number"`
	IsAll      bool  `json:"is_all"`
	ExportType int   `json:"export_type"`
}

type LogExportListReply struct {
	PageNumber int64                      `json:"page_number"`
	PageSize   int64                      `json:"page_size"`
	Total      int64                      `json:"total"`
	ExportList []TGdAccessLogCountExport `json:"export_list"`
}

type LogExportDeleteReq struct {
	Id        int64  `json:"id"`
	ExportDir string `json:"export_dir"`
}

type LogExportDeleteReply struct {
	RealPath string `json:"real_path"`
}

type LogQueryInterfaceAnalyzeError struct {
	Code  int    `json:"code"`
	Msg   string `json:"msg"`
	Count int    `json:"count"`
}

type LogQueryInterfaceAnalyzeErrorReply struct {
	List []LogQueryInterfaceAnalyzeError `json:"list"`
}

type LogQueryInterfaceThirdPartyCount struct {
	ProviderName    string `json:"provider_name"`
	ProviderApiName string `json:"provider_api_name"`
	Count           int    `json:"count"`
}

type LogQueryInterfaceThirdPartyCountReply struct {
	List []LogQueryInterfaceThirdPartyCount
}

type ThirdPartyInterfaceErrorAnalyzeReq struct {
	ProviderApiId  int64 `json:"provider_api_id"`
	Status         int   `json:"status"`
	StartTimestamp int64 `json:"start_timestamp"`
	EndTimestamp   int64 `json:"end_timestamp"`
}

type ThirdPartyInterfaceErrorAnalyze struct {
	Code  string `json:"code"`
	Msg   string `json:"msg"`
	Count int    `json:"count"`
}

type ThirdPartyInterfaceErrorAnalyzeReply struct {
	List []ThirdPartyInterfaceErrorAnalyze `json:"list"`
}
