package admin

import "time"

type WafLog struct {
	Id         int    `json:"id" form:"id" gorm:"column:id;primary_key;AUTO_INCREMENT;not null"`
	Uid        int    `json:"uid" form:"uid" gorm:"column:uid;default:0;not null"`
	Name       string `json:"name" form:"name" gorm:"column:name"`
	RequestIp  string `json:"requestIp" form:"requestIp" gorm:"column:request_ip"`
	RuleId     int    `json:"ruleId" form:"ruleId" gorm:"column:rule_id;default:0"`
	HostId     int    `json:"hostId" form:"hostId" gorm:"column:host_id;default:0"`
	UserAgent  string `json:"userAgent" form:"userAgent" gorm:"column:user_agent"`
	Api        string `json:"api" form:"api" gorm:"column:api"`
	ApiName    string `json:"apiName" form:"apiName" gorm:"column:api_name"`
	ApiType    string `json:"apiType" form:"apiType" gorm:"column:api_type"`
	ExtraData  interface{} `json:"extraData" form:"extraData" gorm:"column:extra_data"`
}

type SearchWafLogParams struct {
	Id         int    `json:"id" form:"id" gorm:"column:id;primary_key;AUTO_INCREMENT;not null"`
	Uid        int    `json:"uid" form:"uid" gorm:"column:uid;default:0;not null"`
	Name       string `json:"name" form:"name" gorm:"column:name"`
	RequestIp  string `json:"requestIp" form:"requestIp" gorm:"column:request_ip"`
	RuleId     int    `json:"ruleId" form:"ruleId" gorm:"column:rule_id;default:0"`
	HostId     int    `json:"hostId" form:"hostId" gorm:"column:host_id;default:0"`
	UserAgent  string `json:"userAgent" form:"userAgent" gorm:"column:user_agent"`
	Api        string `json:"api" form:"api" gorm:"column:api"`
	ApiName    string `json:"apiName" form:"apiName" gorm:"column:api_name"`
	ApiType    string `json:"apiType" form:"apiType" gorm:"column:api_type"`
	Current  int	`form:"current" json:"current" default:"1"`
	PageSize int	`form:"pageSize" json:"pageSize" default:"10"`
	Column   string `form:"column" json:"column" default:"id"`
	Order    string `form:"order" json:"order" default:"desc"`
}

type WafLogId struct {
	Id int `json:"id" form:"id" validate:"required,min=1"`
}


type ExportWafLog struct {
	Id         int    `json:"id" form:"id"`
	Uid        int    `json:"uid" form:"uid"`
	Name       string `json:"name" form:"name"`
	RequestIp  string `json:"requestIp" form:"requestIp"`
	RuleId     int    `json:"ruleId" form:"ruleId"`
	HostIds     []int   `json:"hostIds" form:"hostIds"`
	UserAgent  string `json:"userAgent" form:"userAgent"`
	Api        string `json:"api" form:"api"`
	ApiNames    []string `json:"apiNames" form:"apiNames"`
	ApiTypes    []string `json:"apiTypes" form:"apiTypes"`
	StartTime  string `json:"startTime" form:"startTime"`
	EndTime    string `json:"endTime" form:"endTime"`
}

type ExportWafLogRes struct {
	Name       string `json:"name" form:"name"`
	RequestIp  string `json:"requestIp" form:"requestIp"`
	HostId     int    `json:"hostId" form:"hostId"`
	ApiName    string `json:"apiName" form:"apiName"`
	AddrBackendList  interface{} `json:"addrBackendList" form:"addrBackendList"`
	Domain     string `json:"domain" form:"domain"`
	CustomHost string `json:"customHost" form:"customHost"`
	ExposeAddr  []string `json:"exposeAddr" form:"exposeAddr"`
	Comment    string `json:"comment" form:"comment"`
	CreatedAt  time.Time `json:"createdAt" form:"createdAt"`
}