package param

import (
	"wireguard-ui/global/constant"
)

// SaveClient
// @description: 新增/编辑客户端
type SaveClient struct {
	Id                string           `json:"id" form:"id" label:"id" binding:"omitempty"`                                             // id
	Name              string           `json:"name" form:"name" label:"名称" binding:"required,min=1,max=64"`                             // 名称
	Email             string           `json:"email" form:"email" label:"联系邮箱" binding:"omitempty"`                                     // 联系邮箱
	SubnetRange       string           `json:"subnetRange" form:"subnetRange" label:"子网范围" binding:"omitempty"`                         // 子网范围
	IpAllocation      []string         `json:"ipAllocation" form:"ipAllocation" label:"客户端IP" binding:"required,dive"`                  // IP地址
	AllowedIps        []string         `json:"allowedIps" form:"allowedIps" label:"allowedIps" binding:"omitempty,dive"`                // 允许访问的IP段
	ExtraAllowedIps   []string         `json:"extraAllowedIps" form:"extraAllowedIps" label:"extraAllowedIps" binding:"omitempty,dive"` // 其他允许访问的IP段
	Endpoint          string           `json:"endpoint" form:"endpoint" label:"endpoint" binding:"omitempty"`                           // 服务端地址
	UseServerDns      *constant.Status `json:"useServerDns" form:"useServerDns" label:"useServerDns" binding:"required,oneof=0 1"`      // 是否使用服务端DNS   1 - 是 | 0 - 否
	Keys              *Keys            `json:"keys" form:"keys" label:"密钥信息" binding:"required"`                                        // 密钥
	Enabled           *constant.Status `json:"enabled" form:"enabled" label:"状态" binding:"required,oneof=0 1"`                          // 状态  1 - 启用 | 0 - 禁用
	OfflineMonitoring *constant.Status `json:"offlineMonitoring" form:"offlineMonitoring" label:"离线通知" binding:"required,oneof=0 1"`    // 离线通知 1 - 启用 | 0 - 禁用
}

// Keys
// @description: 客户端密钥信息
type Keys struct {
	PrivateKey   string `json:"privateKey" form:"privateKey" label:"私钥" binding:"required"`
	PublicKey    string `json:"publicKey" form:"publicKey" label:"公钥" binding:"required"`
	PresharedKey string `json:"presharedKey" form:"presharedKey" label:"共享密钥" binding:"required"`
}

// ClientList
// @description: 客户端列表
type ClientList struct {
	Name         string `json:"name" form:"name" label:"名称" binding:"omitempty"`                    // 客户端名称
	Email        string `json:"email" form:"email" label:"邮箱" binding:"omitempty,email"`            // 联系邮箱
	IpAllocation string `json:"ipAllocation" form:"ipAllocation" label:"IP范围段" binding:"omitempty"` // 客户端IP
	Enabled      *int   `json:"enabled" form:"enabled" label:"状态" binding:"omitempty,oneof=0 1"`    // 客户端状态
	Page
}