package v1


type WebForwardingDataRequest struct {
	Id                 int    `form:"id" json:"id"`
	CdnWebId          int    `form:"cdnWebId" json:"cdnWebId"`
	Port               string    `form:"port" json:"port" validate:"required,isPortStringValid"`
	Domain             string `form:"domain" json:"domain" validate:"omitempty,idn_fqdn|ip"`
	BackendList        []BackendList `form:"backendList" json:"backendList" validate:"required,dive"`
	IsHttps            int    `form:"isHttps" json:"isHttps" default:"0"`
	Comment            string `form:"comment" json:"comment" validate:"max=50"`
	HttpsCert          string `form:"httpsCert" json:"httpsCert"`
	HttpsKey           string `form:"httpsKey" json:"httpsKey"`
	SslPolicyId        int64    `form:"sslPolicyId" json:"sslPolicyId"`
	SslCertId          int64    `form:"sslCertId" json:"sslCertId"`
	Proxy 				bool `form:"proxy" json:"proxy" default:"false"`
	CcConfig           CcConfigRequest `form:"ccConfig" json:"ccConfig"`
}

type DeleteWebForwardingRequest struct {
	Ids   []int `form:"ids" json:"ids" validate:"required,min=1,dive,required"`
	Uid   int   `form:"uid" json:"uid" validate:"required"`
	HostId   int   `form:"hostId" json:"hostId" validate:"required"`
}

type WebForwardingRequest struct {
	HostId            int `form:"hostId" json:"hostId" validate:"required"`
	Uid               int `form:"uid" json:"uid" validate:"required"`
	WebForwardingData WebForwardingDataRequest `form:"data" json:"data" validate:"required"`
}


type BackendList struct {
	Addr     string `json:"addr,omitempty" form:"addr" validate:"required,hostport"`
	CustomHost string `json:"customHost,omitempty" form:"customHost" validate:"omitempty,idn_fqdn"`
	IsHttps  int    `json:"isHttps,omitempty" form:"isHttps" default:"0"`
}

type CcConfigRequest struct {
	IsOn  bool `form:"isOn" json:"isOn" default:"false"`
	ThresholdMethod string `form:"thresholdMethod" json:"thresholdMethod" default:"default"` //阈值设置
	Limit5s int `form:"limit5s" json:"limit5s"`
	Limit60s int `form:"limit60s" json:"limit60s"`
	Limit300s int `form:"limit300s" json:"limit300s"`
	Level string `form:"level" json:"level" default:"low"` //拦截强度
}

type Domain struct {
	Id     int    `gorm:"column:id"`
	Domain string `gorm:"column:domain"`
	IsHttps int    `gorm:"column:is_https"`
}

