package model

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

type UdpForWarding struct {
	Id                   int `gorm:"primary"`
	HostId               int `gorm:"not null"`
	CdnWebId            int `gorm:"not null"`
	Port                 string `gorm:"not null"`
	Comment              string `gorm:"null"`
	Proxy 				bool `gorm:"not null"`
	CreatedAt            time.Time
	UpdatedAt            time.Time
}

func (m *UdpForWarding) TableName() string {
    return "shd_waf_udp"
}

// UdpForwardingRule 用于存储UDP转发规则
type UdpForwardingRule struct {
	ID          primitive.ObjectID `bson:"_id,omitempty"`
	Uid         int                `bson:"uid" json:"uid"`
	HostId      int                `bson:"host_id" json:"host_id"`
	UdpId       int                `bson:"udp_id" json:"udp_id"`
	CdnOriginIds map[string]int64  `bson:"cdn_origin_ids" json:"cdn_origin_ids"`
	BackendList []string           `bson:"backend_list" json:"backend_list"`
	CreatedAt   time.Time          `bson:"created_at" json:"created_at"`
	UpdatedAt   time.Time          `bson:"updated_at" json:"updated_at"`
}

func (m *UdpForwardingRule) CollectionName() string {
	return "udp_forwarding_rules"
}
