package model

import (
	"go.mongodb.org/mongo-driver/bson/primitive"
	"time"
)

type Tcpforwarding struct {
	Id                   int `gorm:"primary"`
	HostId               int `gorm:"not null"`
	WafTcpId            int `gorm:"not null"`
	Tag                  string `gorm:"null"`
	Port                 string `gorm:"not null"`
	WafGatewayGroupId    int `gorm:"null"`
	TcpLimitRuleId       int `gorm:"not null"`
	CcCount              int `gorm:"default:0"`
	CcDuration           string `gorm:"default:0s"`
	CcBlockCount         int `gorm:"default:0"`
	CcBlockDuration      string `gorm:"null"`
	BackendProtocol      string `gorm:"default:tcp"`
	BackendTimeout       string `gorm:"null"`
	Comment              string `gorm:"null"`
	CreatedAt            time.Time
	UpdatedAt            time.Time
}

func (m *Tcpforwarding) TableName() string {
    return "shd_waf_tcp"
}


type TcpForwardingRule struct {
	ID          primitive.ObjectID `bson:"_id,omitempty"`
	Uid         int                `bson:"uid" json:"uid"`
	HostId      int                `bson:"host_id" json:"host_id"`
	TcpId       int                `bson:"tcp_id" json:"tcp_id"`
	BackendList []string           `bson:"backend_list" json:"backend_list"`
	AllowIpList []string           `bson:"allow_ip_list" json:"allow_ip_list"`
	DenyIpList  []string           `bson:"deny_ip_list" json:"deny_ip_list"`
	AccessRule  string             `bson:"access_rule" json:"access_rule"`
	CreatedAt   time.Time          `bson:"created_at" json:"created_at"`
	UpdatedAt   time.Time          `bson:"updated_at" json:"updated_at"`
}

func (m *TcpForwardingRule) CollectionName() string {
	return "tcp_forwarding_rules"
}