syntax = "v1"

info (
	title:   "Interface Model"
	desc:    "API for ppanel"
	author:  "Tension"
	email:   "tension@ppanel.com"
	version: "0.0.1"
)

type (
	User {
		Id                    int64            `json:"id"`
		Avatar                string           `json:"avatar"`
		Balance               int64            `json:"balance"`
		Commission            int64            `json:"commission"`
		ReferralPercentage    uint8            `json:"referral_percentage"`
		OnlyFirstPurchase     bool             `json:"only_first_purchase"`
		GiftAmount            int64            `json:"gift_amount"`
		Telegram              int64            `json:"telegram"`
		ReferCode             string           `json:"refer_code"`
		RefererId             int64            `json:"referer_id"`
		ShareLink             string           `json:"share_link,omitempty"`
		Enable                bool             `json:"enable"`
		IsAdmin               bool             `json:"is_admin,omitempty"`
		EnableBalanceNotify   bool             `json:"enable_balance_notify"`
		EnableLoginNotify     bool             `json:"enable_login_notify"`
		EnableSubscribeNotify bool             `json:"enable_subscribe_notify"`
		EnableTradeNotify     bool             `json:"enable_trade_notify"`
		UseStatus             bool             `json:"use_status"` // Whether to show the "bind email to get free trial" prompt
		AuthMethods           []UserAuthMethod `json:"auth_methods"`
		UserDevices           []UserDevice     `json:"user_devices"`
		Rules                 []string         `json:"rules"`
		LastLoginTime         int64            `json:"last_login_time,omitempty"`
		MemberStatus          string           `json:"member_status,omitempty"`
		CreatedAt             int64            `json:"created_at"`
		UpdatedAt             int64            `json:"updated_at"`
		DeletedAt             int64            `json:"deleted_at,omitempty"`
		IsDel                 bool             `json:"is_del,omitempty"`
		Remark                string           `json:"remark,omitempty"`
		PurchasedPackage      string           `json:"purchased_package,omitempty"`
		FamilyJoined          bool             `json:"family_joined,omitempty"`
		FamilyId              int64            `json:"family_id,omitempty"`
		FamilyRole            uint8            `json:"family_role,omitempty"`
		FamilyRoleName        string           `json:"family_role_name,omitempty"`
		FamilyOwnerUserId     int64            `json:"family_owner_user_id,omitempty"`
		FamilyStatus          string           `json:"family_status,omitempty"`
		FamilyMemberCount     int64            `json:"family_member_count,omitempty"`
		FamilyMaxMembers      int64            `json:"family_max_members,omitempty"`
	}
	Follow {
		Id        int64  `json:"id"`
		TicketId  int64  `json:"ticket_id"`
		From      string `json:"from"`
		Type      uint8  `json:"type"`
		Content   string `json:"content"`
		CreatedAt int64  `json:"created_at"`
	}
	Ticket {
		Id          int64    `json:"id"`
		Title       string   `json:"title"`
		Description string   `json:"description"`
		UserId      int64    `json:"user_id"`
		Follows     []Follow `json:"follow,omitempty"`
		Status      uint8    `json:"status"`
		CreatedAt   int64    `json:"created_at"`
		UpdatedAt   int64    `json:"updated_at"`
	}
	SiteConfig {
		Host       string `json:"host"`
		SiteName   string `json:"site_name"`
		SiteDesc   string `json:"site_desc"`
		SiteLogo   string `json:"site_logo"`
		Keywords   string `json:"keywords"`
		CustomHTML string `json:"custom_html"`
		CustomData string `json:"custom_data"`
	}
	SubscribeConfig {
		SingleModel     bool   `json:"single_model"`
		SubscribePath   string `json:"subscribe_path"`
		SubscribeDomain string `json:"subscribe_domain"`
		PanDomain       bool   `json:"pan_domain"`
		UserAgentLimit  bool   `json:"user_agent_limit"`
		UserAgentList   string `json:"user_agent_list"`
	}
	VerifyCodeConfig {
		VerifyCodeExpireTime int64 `json:"verify_code_expire_time"`
		VerifyCodeLimit      int64 `json:"verify_code_limit"`
		VerifyCodeInterval   int64 `json:"verify_code_interval"`
	}
	SignatureConfig {
		EnableSignature bool `json:"enable_signature"`
	}
	PubilcVerifyCodeConfig {
		VerifyCodeInterval int64 `json:"verify_code_interval"`
	}
	SubscribeType {
		SubscribeTypes []string `json:"subscribe_types"`
	}
	Application {
		Id            int64  `json:"id"`
		Icon          string `json:"icon"`
		Name          string `json:"name"`
		Description   string `json:"description"`
		SubscribeType string `json:"subscribe_type"`
	}
	ApplicationVersion {
		Id          int64  `json:"id"`
		Url         string `json:"url"`
		Version     string `json:"version" validate:"required"`
		Description string `json:"description"`
		IsDefault   bool   `json:"is_default"`
	}
	ApplicationResponse {
		Applications []ApplicationResponseInfo `json:"applications"`
	}
	ApplicationResponseInfo {
		Id            int64               `json:"id"`
		Name          string              `json:"name"`
		Icon          string              `json:"icon"`
		Description   string              `json:"description"`
		SubscribeType string              `json:"subscribe_type"`
		Platform      ApplicationPlatform `json:"platform"`
	}
	ApplicationPlatform {
		IOS     []*ApplicationVersion `json:"ios,omitempty"`
		MacOS   []*ApplicationVersion `json:"macos,omitempty"`
		Linux   []*ApplicationVersion `json:"linux,omitempty"`
		Android []*ApplicationVersion `json:"android,omitempty"`
		Windows []*ApplicationVersion `json:"windows,omitempty"`
		Harmony []*ApplicationVersion `json:"harmony,omitempty"`
	}
	AuthConfig {
		Mobile   MobileAuthenticateConfig `json:"mobile"`
		Email    EmailAuthticateConfig    `json:"email"`
		Device   DeviceAuthticateConfig   `json:"device"`
		Register PubilcRegisterConfig     `json:"register"`
	}
	PubilcRegisterConfig {
		StopRegister            bool  `json:"stop_register"`
		EnableIpRegisterLimit   bool  `json:"enable_ip_register_limit"`
		IpRegisterLimit         int64 `json:"ip_register_limit"`
		IpRegisterLimitDuration int64 `json:"ip_register_limit_duration"`
	}
	MobileAuthenticateConfig {
		Enable          bool     `json:"enable"`
		EnableWhitelist bool     `json:"enable_whitelist"`
		Whitelist       []string `json:"whitelist"`
	}
	EmailAuthticateConfig {
		Enable             bool   `json:"enable"`
		EnableVerify       bool   `json:"enable_verify"`
		EnableDomainSuffix bool   `json:"enable_domain_suffix"`
		DomainSuffixList   string `json:"domain_suffix_list"`
	}
	DeviceAuthticateConfig {
		Enable         bool `json:"enable"`
		ShowAds        bool `json:"show_ads"`
		EnableSecurity bool `json:"enable_security"`
		OnlyRealDevice bool `json:"only_real_device"`
	}
	RegisterConfig {
		StopRegister            bool   `json:"stop_register"`
		EnableTrial             bool   `json:"enable_trial"`
		TrialSubscribe          int64  `json:"trial_subscribe"`
		TrialTime               int64  `json:"trial_time"`
		TrialTimeUnit           string `json:"trial_time_unit"`
		EnableIpRegisterLimit   bool   `json:"enable_ip_register_limit"`
		IpRegisterLimit         int64  `json:"ip_register_limit"`
		IpRegisterLimitDuration int64  `json:"ip_register_limit_duration"`
		DeviceLimit             int64  `json:"device_limit"`
	}
	VerifyConfig {
		CaptchaType                   string `json:"captcha_type"`                      // local or turnstile
		TurnstileSiteKey              string `json:"turnstile_site_key"`
		TurnstileSecret               string `json:"turnstile_secret"`
		EnableUserLoginCaptcha        bool   `json:"enable_user_login_captcha"`         // User login captcha
		EnableUserRegisterCaptcha     bool   `json:"enable_user_register_captcha"`      // User register captcha
		EnableAdminLoginCaptcha       bool   `json:"enable_admin_login_captcha"`        // Admin login captcha
		EnableUserResetPasswordCaptcha bool  `json:"enable_user_reset_password_captcha"` // User reset password captcha
	}
	NodeConfig {
		NodeSecret             string         `json:"node_secret"`
		NodePullInterval       int64          `json:"node_pull_interval"`
		NodePushInterval       int64          `json:"node_push_interval"`
		TrafficReportThreshold int64          `json:"traffic_report_threshold"`
		IPStrategy             string         `json:"ip_strategy"`
		DNS                    []NodeDNS      `json:"dns"`
		Block                  []string       `json:"block"`
		Outbound               []NodeOutbound `json:"outbound"`
	}
	NodeDNS {
		Proto   string   `json:"proto"`
		Address string   `json:"address"`
		Domains []string `json:"domains"`
	}
	NodeOutbound {
		Name     string   `json:"name"`
		Protocol string   `json:"protocol"`
		Address  string   `json:"address"`
		Port     int64    `json:"port"`
		Password string   `json:"password"`
		Rules    []string `json:"rules"`
	}
	InviteConfig {
		ForcedInvite       bool  `json:"forced_invite"`
		ReferralPercentage int64 `json:"referral_percentage"`
		OnlyFirstPurchase  bool  `json:"only_first_purchase"`
		GiftDays           int64 `json:"gift_days"`
	}
	TelegramConfig {
		TelegramBotToken      string `json:"telegram_bot_token"`
		TelegramGroupUrl      string `json:"telegram_group_url"`
		TelegramNotify        bool   `json:"telegram_notify"`
		TelegramWebHookDomain string `json:"telegram_web_hook_domain"`
	}
	TosConfig {
		TosContent string `json:"tos_content"`
	}
	PrivacyPolicyConfig {
		PrivacyPolicy string `json:"privacy_policy"`
	}
	CurrencyConfig {
		AccessKey      string `json:"access_key"`
		CurrencyUnit   string `json:"currency_unit"`
		CurrencySymbol string `json:"currency_symbol"`
	}
	SubscribeDiscount {
		Quantity int64   `json:"quantity"`
		Discount float64 `json:"discount"`
		MapApple string  `json:"map_apple"`
	}
	TrafficLimit {
		StatType     string `json:"stat_type"`
		StatValue    int64  `json:"stat_value"`
		TrafficUsage int64  `json:"traffic_usage"`
		SpeedLimit   int64  `json:"speed_limit"`
	}
	Subscribe {
		Id                int64               `json:"id"`
		Name              string              `json:"name"`
		Language          string              `json:"language"`
		Description       string              `json:"description"`
		UnitPrice         int64               `json:"unit_price"`
		UnitTime          string              `json:"unit_time"`
		Discount          []SubscribeDiscount `json:"discount"`
		NodeCount         int64               `json:"node_count"`
		Replacement       int64               `json:"replacement"`
		Inventory         int64               `json:"inventory"`
		Traffic           int64               `json:"traffic"`
		SpeedLimit        int64               `json:"speed_limit"`
		DeviceLimit       int64               `json:"device_limit"`
		Quota             int64               `json:"quota"`
		Nodes             []int64             `json:"nodes"`
		NodeTags          []string            `json:"node_tags"`
		NodeGroupIds      []int64             `json:"node_group_ids,omitempty"`
		NodeGroupId       int64               `json:"node_group_id"`
		TrafficLimit      []TrafficLimit      `json:"traffic_limit"`
		Show              bool                `json:"show"`
		Sell              bool                `json:"sell"`
		Sort              int64               `json:"sort"`
		DeductionRatio    int64               `json:"deduction_ratio"`
		AllowDeduction    bool                `json:"allow_deduction"`
		ResetCycle        int64               `json:"reset_cycle"`
		RenewalReset      bool                `json:"renewal_reset"`
		ShowOriginalPrice bool                `json:"show_original_price"`
		CreatedAt         int64               `json:"created_at"`
		UpdatedAt         int64               `json:"updated_at"`
	}
	SubscribeGroup {
		Id          int64  `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
		CreatedAt   int64  `json:"created_at"`
		UpdatedAt   int64  `json:"updated_at"`
	}
	Shadowsocks {
		Method    string `json:"method" validate:"required"`
		Port      int    `json:"port" validate:"required"`
		ServerKey string `json:"server_key"`
	}
	Vmess {
		Port            int             `json:"port" validate:"required"`
		Transport       string          `json:"transport" validate:"required"`
		TransportConfig TransportConfig `json:"transport_config"`
		Security        string          `json:"security" validate:"required"`
		SecurityConfig  SecurityConfig  `json:"security_config"`
	}
	Vless {
		Port            int             `json:"port" validate:"required"`
		Flow            string          `json:"flow" validate:"required"`
		Transport       string          `json:"transport" validate:"required"`
		TransportConfig TransportConfig `json:"transport_config"`
		Security        string          `json:"security" validate:"required"`
		SecurityConfig  SecurityConfig  `json:"security_config"`
	}
	Trojan {
		Port            int             `json:"port" validate:"required"`
		Transport       string          `json:"transport" validate:"required"`
		TransportConfig TransportConfig `json:"transport_config"`
		Security        string          `json:"security" validate:"required"`
		SecurityConfig  SecurityConfig  `json:"security_config"`
	}
	Hysteria2 {
		Port           int            `json:"port" validate:"required"`
		HopPorts       string         `json:"hop_ports" validate:"required"`
		HopInterval    int            `json:"hop_interval" validate:"required"`
		ObfsPassword   string         `json:"obfs_password" validate:"required"`
		SecurityConfig SecurityConfig `json:"security_config"`
	}
	Tuic {
		Port                 int            `json:"port" validate:"required"`
		DisableSNI           bool           `json:"disable_sni"`
		ReduceRtt            bool           `json:"reduce_rtt"`
		UDPRelayMode         string         `json:"udp_relay_mode"`
		CongestionController string         `json:"congestion_controller"`
		SecurityConfig       SecurityConfig `json:"security_config"`
	}
	AnyTLS {
		Port           int            `json:"port" validate:"required"`
		SecurityConfig SecurityConfig `json:"security_config"`
	}
	SecurityConfig {
		SNI               string `json:"sni"`
		AllowInsecure     *bool  `json:"allow_insecure"`
		Fingerprint       string `json:"fingerprint"`
		RealityServerAddr string `json:"reality_server_addr"`
		RealityServerPort int    `json:"reality_server_port"`
		RealityPrivateKey string `json:"reality_private_key"`
		RealityPublicKey  string `json:"reality_public_key"`
		RealityShortId    string `json:"reality_short_id"`
	}
	TransportConfig {
		Path        string `json:"path"`
		Host        string `json:"host"`
		ServiceName string `json:"service_name"`
	}
	// Server {
	//  Id           int64       `json:"id"`
	//  Tags         []string    `json:"tags"`
	//  Country      string      `json:"country"`
	//  City         string      `json:"city"`
	//  Name         string      `json:"name"`
	//  ServerAddr   string      `json:"server_addr"`
	//  RelayMode    string      `json:"relay_mode"`
	//  RelayNode    []NodeRelay `json:"relay_node"`
	//  SpeedLimit   int         `json:"speed_limit"`
	//  TrafficRatio float32     `json:"traffic_ratio"`
	//  GroupId      int64       `json:"group_id"`
	//  Protocol     string      `json:"protocol"`
	//  Config       interface{} `json:"config"`
	//  Enable       *bool       `json:"enable"`
	//  CreatedAt    int64       `json:"created_at"`
	//  UpdatedAt    int64       `json:"updated_at"`
	//  Status       *NodeStatus `json:"status"`
	//  Sort         int64       `json:"sort"`
	// }
	// OnlineUser {
	//  SID int64  `json:"uid"`
	//  IP  string `json:"ip"`
	// }
	// NodeStatus {
	//  Online    interface{} `json:"online"`
	//  Cpu       float64     `json:"cpu"`
	//  Mem       float64     `json:"mem"`
	//  Disk      float64     `json:"disk"`
	//  UpdatedAt int64       `json:"updated_at"`
	// }
	ServerGroup {
		Id          int64  `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
		CreatedAt   int64  `json:"created_at"`
		UpdatedAt   int64  `json:"updated_at"`
	}
	PaymentMethod {
		Id          int64  `json:"id"`
		Name        string `json:"name"`
		Platform    string `json:"platform"`
		Description string `json:"description"`
		Icon        string `json:"icon"`
		FeeMode     uint   `json:"fee_mode"`
		FeePercent  int64  `json:"fee_percent"`
		FeeAmount   int64  `json:"fee_amount"`
	}
	PaymentConfig {
		Id          int64       `json:"id" validate:"required"`
		Name        string      `json:"name" validate:"required"`
		Platform    string      `json:"platform" validate:"required"`
		Description string      `json:"description"`
		Icon        string      `json:"icon,omitempty"`
		Domain      string      `json:"domain,omitempty"`
		Config      interface{} `json:"config" validate:"required"`
		FeeMode     uint        `json:"fee_mode"`
		FeePercent  int64       `json:"fee_percent,omitempty"`
		FeeAmount   int64       `json:"fee_amount,omitempty"`
		Enable      *bool       `json:"enable" validate:"required"`
	}
	PaymentMethodDetail {
		Id          int64       `json:"id"`
		Name        string      `json:"name"`
		Platform    string      `json:"platform"`
		Description string      `json:"description"`
		Icon        string      `json:"icon"`
		Domain      string      `json:"domain"`
		Config      interface{} `json:"config"`
		FeeMode     uint        `json:"fee_mode"`
		FeePercent  int64       `json:"fee_percent"`
		FeeAmount   int64       `json:"fee_amount"`
		Enable      bool        `json:"enable"`
		NotifyURL   string      `json:"notify_url"`
	}
	Order {
		Id             int64         `json:"id"`
		UserId         int64         `json:"user_id"`
		OrderNo        string        `json:"order_no"`
		Type           uint8         `json:"type"`
		Quantity       int64         `json:"quantity"`
		Price          int64         `json:"price"`
		Amount         int64         `json:"amount"`
		GiftAmount     int64         `json:"gift_amount"`
		Discount       int64         `json:"discount"`
		Coupon         string        `json:"coupon"`
		CouponDiscount int64         `json:"coupon_discount"`
		Commission     int64         `json:"commission,omitempty"`
		Payment        PaymentMethod `json:"payment"`
		FeeAmount      int64         `json:"fee_amount"`
		TradeNo        string        `json:"trade_no"`
		Status         uint8         `json:"status"`
		SubscribeId    int64         `json:"subscribe_id"`
		CreatedAt      int64         `json:"created_at"`
		UpdatedAt      int64         `json:"updated_at"`
	}
	OrderDetail {
		Id             int64         `json:"id"`
		UserId         int64         `json:"user_id"`
		OrderNo        string        `json:"order_no"`
		Type           uint8         `json:"type"`
		Quantity       int64         `json:"quantity"`
		Price          int64         `json:"price"`
		Amount         int64         `json:"amount"`
		GiftAmount     int64         `json:"gift_amount"`
		Discount       int64         `json:"discount"`
		Coupon         string        `json:"coupon"`
		CouponDiscount int64         `json:"coupon_discount"`
		Commission     int64         `json:"commission,omitempty"`
		Payment        PaymentMethod `json:"payment"`
		Method         string        `json:"method"`
		FeeAmount      int64         `json:"fee_amount"`
		TradeNo        string        `json:"trade_no"`
		Status         uint8         `json:"status"`
		SubscribeId    int64         `json:"subscribe_id"`
		Subscribe      Subscribe     `json:"subscribe"`
		CreatedAt      int64         `json:"created_at"`
		UpdatedAt      int64         `json:"updated_at"`
	}
	Document {
		Id        int64    `json:"id"`
		Title     string   `json:"title"`
		Content   string   `json:"content"`
		Tags      []string `json:"tags"`
		Show      bool     `json:"show"`
		CreatedAt int64    `json:"created_at"`
		UpdatedAt int64    `json:"updated_at"`
	}
	Coupon {
		Id         int64   `json:"id"`
		Name       string  `json:"name"`
		Code       string  `json:"code"`
		Count      int64   `json:"count"`
		Type       uint8   `json:"type"`
		Discount   int64   `json:"discount"`
		StartTime  int64   `json:"start_time"`
		ExpireTime int64   `json:"expire_time"`
		UserLimit  int64   `json:"user_limit"`
		Subscribe  []int64 `json:"subscribe"`
		UsedCount  int64   `json:"used_count"`
		Enable     bool    `json:"enable"`
		CreatedAt  int64   `json:"created_at"`
		UpdatedAt  int64   `json:"updated_at"`
	}
	RedemptionCode {
		Id            int64  `json:"id"`
		Code          string `json:"code"`
		TotalCount    int64  `json:"total_count"`
		UsedCount     int64  `json:"used_count"`
		SubscribePlan int64  `json:"subscribe_plan"`
		UnitTime      string `json:"unit_time"`
		Quantity      int64  `json:"quantity"`
		Status        int64  `json:"status"`
		CreatedAt     int64  `json:"created_at"`
		UpdatedAt     int64  `json:"updated_at"`
	}
	RedemptionRecord {
		Id               int64  `json:"id"`
		RedemptionCodeId int64  `json:"redemption_code_id"`
		UserId           int64  `json:"user_id"`
		SubscribeId      int64  `json:"subscribe_id"`
		UnitTime         string `json:"unit_time"`
		Quantity         int64  `json:"quantity"`
		RedeemedAt       int64  `json:"redeemed_at"`
		CreatedAt        int64  `json:"created_at"`
	}
	Announcement {
		Id        int64  `json:"id"`
		Title     string `json:"title"`
		Content   string `json:"content"`
		Show      *bool  `json:"show"`
		Pinned    *bool  `json:"pinned"`
		Popup     *bool  `json:"popup"`
		CreatedAt int64  `json:"created_at"`
		UpdatedAt int64  `json:"updated_at"`
	}
	UserSubscribe {
		Id                     int64     `json:"id"`
		UserId                 int64     `json:"user_id"`
		OrderId                int64     `json:"order_id"`
		SubscribeId            int64     `json:"subscribe_id"`
		Subscribe              Subscribe `json:"subscribe"`
		StartTime              int64     `json:"start_time"`
		ExpireTime             int64     `json:"expire_time"`
		FinishedAt             int64     `json:"finished_at"`
		ResetTime              int64     `json:"reset_time"`
		Traffic                int64     `json:"traffic"`
		Download               int64     `json:"download"`
		Upload                 int64     `json:"upload"`
		Token                  string    `json:"token"`
		Status                 uint8     `json:"status"`
		EntitlementSource      string    `json:"entitlement_source"`
		EntitlementOwnerUserId int64     `json:"entitlement_owner_user_id"`
		ReadOnly               bool      `json:"read_only"`
		IsGift                 bool      `json:"is_gift"`
		Short                  string    `json:"short"`
		CreatedAt              int64     `json:"created_at"`
		UpdatedAt              int64     `json:"updated_at"`
	}
	UserAffiliate {
		Avatar       string `json:"avatar"`
		Identifier   string `json:"identifier"`
		RegisteredAt int64  `json:"registered_at"`
		Enable       bool   `json:"enable"`
	}
	SortItem {
		Id   int64 `json:"id" validate:"required"`
		Sort int64 `json:"sort" validate:"required"`
	}
	TimePeriod {
		StartTime  string  `json:"start_time"`
		EndTime    string  `json:"end_time"`
		Multiplier float32 `json:"multiplier"`
	}
	NodeRelay {
		Host   string `json:"host"`
		Port   int    `json:"port"`
		Prefix string `json:"prefix"`
	}
	UserDevice {
		Id         int64  `json:"id"`
		Ip         string `json:"ip"`
		Identifier string `json:"identifier"`
		DeviceNo   string `json:"device_no"`
		UserAgent  string `json:"user_agent"`
		Online     bool   `json:"online"`
		Enabled    bool   `json:"enabled"`
		CreatedAt  int64  `json:"created_at"`
		UpdatedAt  int64  `json:"updated_at"`
	}
	FamilySummary {
		FamilyId          int64  `json:"family_id"`
		OwnerUserId       int64  `json:"owner_user_id"`
		OwnerIdentifier   string `json:"owner_identifier"`
		OwnerAuthType     string `json:"owner_auth_type"`
		Status            string `json:"status"`
		ActiveMemberCount int64  `json:"active_member_count"`
		MaxMembers        int64  `json:"max_members"`
		CreatedAt         int64  `json:"created_at"`
		UpdatedAt         int64  `json:"updated_at"`
	}
	FamilyMemberItem {
		UserId     int64  `json:"user_id"`
		Identifier string `json:"identifier"`
		AuthType   string `json:"auth_type"`
		DeviceNo   string `json:"device_no"`
		DeviceType string `json:"device_type"`
		Role       uint8  `json:"role"`
		RoleName   string `json:"role_name"`
		Status     uint8  `json:"status"`
		StatusName string `json:"status_name"`
		JoinSource string `json:"join_source"`
		JoinedAt   int64  `json:"joined_at"`
		LeftAt     int64  `json:"left_at,omitempty"`
	}
	FamilyDetail {
		Summary FamilySummary      `json:"summary"`
		Members []FamilyMemberItem `json:"members"`
	}
	UserAuthMethod {
		AuthType       string `json:"auth_type"`
		AuthIdentifier string `json:"auth_identifier"`
		Verified       bool   `json:"verified"`
	}
	AuthMethodConfig {
		Id      int64       `json:"id"`
		Method  string      `json:"method"`
		Config  interface{} `json:"config"`
		Enabled bool        `json:"enabled"`
	}
	TrafficLog {
		Id          int64 `json:"id"`
		ServerId    int64 `json:"server_id"`
		UserId      int64 `json:"user_id"`
		SubscribeId int64 `json:"subscribe_id"`
		Download    int64 `json:"download"`
		Upload      int64 `json:"upload"`
		Timestamp   int64 `json:"timestamp"`
	}
	ServerRuleGroup {
		Id        int64    `json:"id"`
		Icon      string   `json:"icon"`
		Name      string   `json:"name" validate:"required"`
		Type      string   `json:"type"`
		Tags      []string `json:"tags"`
		Rules     string   `json:"rules"`
		Enable    bool     `json:"enable"`
		Default   bool     `json:"default"`
		CreatedAt int64    `json:"created_at"`
		UpdatedAt int64    `json:"updated_at"`
	}
	UserSubscribeLog {
		Id              int64  `json:"id"`
		UserId          int64  `json:"user_id"`
		UserSubscribeId int64  `json:"user_subscribe_id"`
		Token           string `json:"token"`
		IP              string `json:"ip"`
		UserAgent       string `json:"user_agent"`
		Timestamp       int64  `json:"timestamp"`
	}
	UserLoginLog {
		Id        int64  `json:"id"`
		UserId    int64  `json:"user_id"`
		LoginIP   string `json:"login_ip"`
		UserAgent string `json:"user_agent"`
		Success   bool   `json:"success"`
		Timestamp int64  `json:"timestamp"`
	}
	MessageLog {
		Id        int64       `json:"id"`
		Type      uint8       `json:"type"`
		Platform  string      `json:"platform"`
		To        string      `json:"to"`
		Subject   string      `json:"subject"`
		Content   interface{} `json:"content"`
		Status    uint8       `json:"status"`
		CreatedAt int64       `json:"created_at"`
	}
	Ads {
		Id          int    `json:"id"`
		Title       string `json:"title"`
		Type        string `json:"type"`
		Content     string `json:"content"`
		Description string `json:"description"`
		TargetURL   string `json:"target_url"`
		StartTime   int64  `json:"start_time"`
		EndTime     int64  `json:"end_time"`
		Status      int    `json:"status"`
		CreatedAt   int64  `json:"created_at"`
		UpdatedAt   int64  `json:"updated_at"`
	}
	//public order
	PurchaseOrderRequest {
		SubscribeId int64  `json:"subscribe_id"`
		Quantity    int64  `json:"quantity" validate:"required,gt=0,lte=1000"`
		Payment     int64  `json:"payment,omitempty"`
		Coupon      string `json:"coupon,omitempty"`
	}
	PreOrderResponse {
		Price          int64  `json:"price"`
		Amount         int64  `json:"amount"`
		Discount       int64  `json:"discount"`
		GiftAmount     int64  `json:"gift_amount"`
		Coupon         string `json:"coupon"`
		CouponDiscount int64  `json:"coupon_discount"`
		FeeAmount      int64  `json:"fee_amount"`
	}
	PurchaseOrderResponse {
		OrderNo         string `json:"order_no"`
		AppAccountToken string `json:"app_account_token"`
	}
	RenewalOrderRequest {
		UserSubscribeID int64  `json:"user_subscribe_id"`
		Quantity        int64  `json:"quantity" validate:"lte=1000"`
		Payment         int64  `json:"payment"`
		Coupon          string `json:"coupon,omitempty"`
	}
	RenewalOrderResponse {
		OrderNo         string `json:"order_no"`
		AppAccountToken string `json:"app_account_token"`
	}
	ResetTrafficOrderRequest {
		UserSubscribeID int64 `json:"user_subscribe_id"`
		Payment         int64 `json:"payment"`
	}
	ResetTrafficOrderResponse {
		OrderNo string `json:"order_no"`
	}
	RechargeOrderRequest {
		Amount  int64 `json:"amount" validate:"required,gt=0,lte=2000000000"`
		Payment int64 `json:"payment"`
	}
	RechargeOrderResponse {
		OrderNo string `json:"order_no"`
	}
	PreRenewalOrderResponse {
		OrderNo string `json:"orderNo"`
	}
	CloseOrderRequest {
		OrderNo string `json:"orderNo" validate:"required"`
	}
	QueryOrderDetailRequest {
		OrderNo string `form:"order_no" validate:"required"`
	}
	StripePayment {
		Method         string `json:"method"`
		ClientSecret   string `json:"client_secret"`
		PublishableKey string `json:"publishable_key"`
	}
	QueryOrderListRequest {
		Page   int    `form:"page" validate:"required"`
		Size   int    `form:"size" validate:"required"`
		Status int    `form:"status,optional"`
		Search string `form:"search,optional"`
	}
	QueryOrderListResponse {
		Total int64         `json:"total"`
		List  []OrderDetail `json:"list"`
	}
	//public document
	QueryDocumentListResponse {
		Total int64      `json:"total"`
		List  []Document `json:"list"`
	}
	QueryDocumentDetailRequest {
		Id int64 `form:"id" validate:"required"`
	}
	// public payment
	GetAvailablePaymentMethodsResponse {
		List []PaymentMethod `json:"list"`
	}
	// public announcement
	QueryAnnouncementRequest {
		Page   int   `form:"page"`
		Size   int   `form:"size,default=15"`
		Pinned *bool `form:"pinned"`
		Popup  *bool `form:"popup"`
	}
	QueryAnnouncementResponse {
		Total int64          `json:"total"`
		List  []Announcement `json:"announcements"`
	}
	//subscribe
	QuerySubscribeListResponse {
		List  []Subscribe `json:"list"`
		Total int64       `json:"total"`
	}
	QuerySubscribeGroupListResponse {
		List  []SubscribeGroup `json:"list"`
		Total int64            `json:"total"`
	}
	GetUserSubscribeTrafficLogsRequest {
		Page        int   `form:"page"`
		Size        int   `form:"size"`
		UserId      int64 `form:"user_id"`
		SubscribeId int64 `form:"subscribe_id"`
		StartTime   int64 `form:"start_time"`
		EndTime     int64 `form:"end_time"`
	}
	GetUserSubscribeTrafficLogsResponse {
		List  []TrafficLog `json:"list"`
		Total int64        `json:"total"`
	}
	QueryUserAffiliateListResponse {
		List  []UserAffiliate `json:"list"`
		Total int64           `json:"total"`
	}
	PlatformResponse {
		List []PlatformInfo `json:"list"`
	}
	PlatformInfo {
		Platform                 string            `json:"platform"`
		PlatformUrl              string            `json:"platform_url"`
		PlatformFieldDescription map[string]string `json:"platform_field_description"`
	}
	AlipayNotifyResponse {
		ReturnCode string `json:"return_code"`
	}
	EPayNotifyRequest {
		Pid         int64  `json:"pid"          form:"pid"`
		TradeNo     string `json:"trade_no"     form:"trade_no"`
		OutTradeNo  string `json:"out_trade_no" form:"out_trade_no"`
		Type        string `json:"type"         form:"type"`
		Name        string `json:"name"         form:"name"`
		Money       string `json:"money"        form:"money"`
		TradeStatus string `json:"trade_status" form:"trade_status"`
		Param       string `json:"param"        form:"param"`
		Sign        string `json:"sign"         form:"sign"`
		SignType    string `json:"sign_type"    form:"sign_type"`
	}
	QueryUserAffiliateListRequest {
		Page int `form:"page"`
		Size int `form:"size"`
	}
	CheckoutOrderRequest {
		OrderNo   string `json:"orderNo"`
		ReturnUrl string `json:"returnUrl,omitempty"`
	}
	CheckoutOrderResponse {
		Type        string         `json:"type"`
		CheckoutUrl string         `json:"checkout_url,omitempty"`
		Stripe      *StripePayment `json:"stripe,omitempty"`
		ProductIds  []string       `json:"product_ids,omitempty"`
	}
	AttachAppleTransactionRequest {
		OrderNo              string `json:"order_no" validate:"required"`
		SignedTransactionJWS string `json:"signed_transaction_jws" validate:"required"`
		SubscribeId          int64  `json:"subscribe_id,omitempty"`
		DurationDays         int64  `json:"duration_days,omitempty"`
		Tier                 string `json:"tier,omitempty"`
	}
	AttachAppleTransactionByIdRequest {
		OrderNo       string `json:"order_no" validate:"required"`
		TransactionId string `json:"transaction_id" validate:"required"`
		Sandbox       *bool  `json:"sandbox,omitempty"`
	}
	AttachAppleTransactionResponse {
		ExpiresAt int64  `json:"expires_at"`
		Tier      string `json:"tier"`
	}
	RestoreAppleTransactionsRequest {
		Transactions []string `json:"transactions" validate:"required"`
	}
	GetAppleStatusResponse {
		Active    bool   `json:"active"`
		ExpiresAt int64  `json:"expires_at"`
		Tier      string `json:"tier"`
	}
	SiteCustomDataContacts {
		Email     string `json:"email"`
		Telephone string `json:"telephone"`
		Address   string `json:"address"`
	}
	QueryUserAffiliateCountResponse {
		Registers       int64 `json:"registers"`
		TotalCommission int64 `json:"total_commission"`
	}
	AppUserSubcbribe {
		Id          int64                   `json:"id"`
		Name        string                  `json:"name"`
		Upload      int64                   `json:"upload"`
		Traffic     int64                   `json:"traffic"`
		Download    int64                   `json:"download"`
		DeviceLimit int64                   `json:"device_limit"`
		StartTime   string                  `json:"start_time"`
		ExpireTime  string                  `json:"expire_time"`
		List        []AppUserSubscbribeNode `json:"list"`
	}
	AppUserSubscbribeNode {
		Id           int64    `json:"id"`
		Name         string   `json:"name"`
		Uuid         string   `json:"uuid"`
		Protocol     string   `json:"protocol"`
		RelayMode    string   `json:"relay_mode"`
		RelayNode    string   `json:"relay_node"`
		ServerAddr   string   `json:"server_addr"`
		SpeedLimit   int      `json:"speed_limit"`
		Tags         []string `json:"tags"`
		Traffic      int64    `json:"traffic"`
		TrafficRatio float64  `json:"traffic_ratio"`
		Upload       int64    `json:"upload"`
		Config       string   `json:"config"`
		Country      string   `json:"country"`
		City         string   `json:"city"`
		Latitude     string   `json:"latitude"`
		Longitude    string   `json:"longitude"`
		CreatedAt    int64    `json:"created_at"`
		Download     int64    `json:"download"`
	}
	DownloadLink {
		IOS     string `json:"ios,omitempty"`
		Android string `json:"android,omitempty"`
		Windows string `json:"windows,omitempty"`
		Mac     string `json:"mac,omitempty"`
		Linux   string `json:"linux,omitempty"`
		Harmony string `json:"harmony,omitempty"`
	}
	ResetSubscribeTrafficLog {
		Id              int64  `json:"id"`
		Type            uint16 `json:"type"`
		UserSubscribeId int64  `json:"user_subscribe_id"`
		OrderNo         string `json:"order_no,omitempty"`
		Timestamp       int64  `json:"timestamp"`
	}
	BalanceLog {
		Type      uint16 `json:"type"`
		UserId    int64  `json:"user_id"`
		Amount    int64  `json:"amount"`
		OrderNo   string `json:"order_no,omitempty"`
		Balance   int64  `json:"balance"`
		Timestamp int64  `json:"timestamp"`
	}
	CommissionLog {
		Type      uint16 `json:"type"`
		UserId    int64  `json:"user_id"`
		Amount    int64  `json:"amount"`
		OrderNo   string `json:"order_no"`
		Timestamp int64  `json:"timestamp"`
	}
	Protocol {
		Type                    string  `json:"type"`
		Port                    uint16  `json:"port"`
		Enable                  bool    `json:"enable"`
		Security                string  `json:"security,omitempty"`
		SNI                     string  `json:"sni,omitempty"`
		AllowInsecure           bool    `json:"allow_insecure,omitempty"`
		Fingerprint             string  `json:"fingerprint,omitempty"`
		RealityServerAddr       string  `json:"reality_server_addr,omitempty"`
		RealityServerPort       int     `json:"reality_server_port,omitempty"`
		RealityPrivateKey       string  `json:"reality_private_key,omitempty"`
		RealityPublicKey        string  `json:"reality_public_key,omitempty"`
		RealityShortId          string  `json:"reality_short_id,omitempty"`
		Transport               string  `json:"transport,omitempty"`
		Host                    string  `json:"host,omitempty"`
		Path                    string  `json:"path,omitempty"`
		ServiceName             string  `json:"service_name,omitempty"`
		Cipher                  string  `json:"cipher,omitempty"`
		ServerKey               string  `json:"server_key,omitempty"`
		Flow                    string  `json:"flow,omitempty"`
		HopPorts                string  `json:"hop_ports,omitempty"`
		HopInterval             int     `json:"hop_interval,omitempty"`
		ObfsPassword            string  `json:"obfs_password,omitempty"`
		DisableSNI              bool    `json:"disable_sni,omitempty"`
		ReduceRtt               bool    `json:"reduce_rtt,omitempty"`
		UDPRelayMode            string  `json:"udp_relay_mode,omitempty"`
		CongestionController    string  `json:"congestion_controller,omitempty"`
		Multiplex               string  `json:"multiplex,omitempty"` // mux, eg: off/low/medium/high
		PaddingScheme           string  `json:"padding_scheme,omitempty"` // padding scheme
		UpMbps                  int     `json:"up_mbps,omitempty"` // upload speed limit
		DownMbps                int     `json:"down_mbps,omitempty"` // download speed limit
		Obfs                    string  `json:"obfs,omitempty"` // obfs, 'none', 'http', 'tls'
		ObfsHost                string  `json:"obfs_host,omitempty"` // obfs host
		ObfsPath                string  `json:"obfs_path,omitempty"` // obfs path
		XhttpMode               string  `json:"xhttp_mode,omitempty"` // xhttp mode
		XhttpExtra              string  `json:"xhttp_extra,omitempty"` // xhttp extra path
		Encryption              string  `json:"encryption,omitempty"` // encryption，'none', 'mlkem768x25519plus'
		EncryptionMode          string  `json:"encryption_mode,omitempty"` // encryption mode，'native', 'xorpub', 'random'
		EncryptionRtt           string  `json:"encryption_rtt,omitempty"` // encryption rtt，'0rtt', '1rtt'
		EncryptionTicket        string  `json:"encryption_ticket,omitempty"` // encryption ticket
		EncryptionServerPadding string  `json:"encryption_server_padding,omitempty"` // encryption server padding
		EncryptionPrivateKey    string  `json:"encryption_private_key,omitempty"` // encryption private key
		EncryptionClientPadding string  `json:"encryption_client_padding,omitempty"` // encryption client padding
		EncryptionPassword      string  `json:"encryption_password,omitempty"` // encryption password
		Ratio                   float64 `json:"ratio,omitempty"` // Traffic ratio, default is 1
		CertMode                string  `json:"cert_mode,omitempty"` // Certificate mode, `none`｜`http`｜`dns`｜`self`
		CertDNSProvider         string  `json:"cert_dns_provider,omitempty"` // DNS provider for certificate
		CertDNSEnv              string  `json:"cert_dns_env,omitempty"` // Environment for DNS provider
	}
	// reset user subscribe token
	ResetUserSubscribeTokenRequest {
		UserSubscribeId int64 `json:"user_subscribe_id"`
	}
	// ===== 分组功能类型定义 =====
	// NodeGroup 节点组
	NodeGroup {
		Id                  int64  `json:"id"`
		Name                string `json:"name"`
		Description         string `json:"description"`
		Sort                int    `json:"sort"`
		ForCalculation      bool   `json:"for_calculation"`
		IsExpiredGroup      bool   `json:"is_expired_group"`
		ExpiredDaysLimit    int    `json:"expired_days_limit"`
		MaxTrafficGBExpired int64  `json:"max_traffic_gb_expired,omitempty"`
		SpeedLimit          int    `json:"speed_limit"`
		MinTrafficGB        int64  `json:"min_traffic_gb,omitempty"`
		MaxTrafficGB        int64  `json:"max_traffic_gb,omitempty"`
		NodeCount           int64  `json:"node_count,omitempty"`
		CreatedAt           int64  `json:"created_at"`
		UpdatedAt           int64  `json:"updated_at"`
	}
	// GroupHistory 分组历史记录
	GroupHistory {
		Id           int64  `json:"id"`
		GroupMode    string `json:"group_mode"`
		TriggerType  string `json:"trigger_type"`
		TotalUsers   int    `json:"total_users"`
		SuccessCount int    `json:"success_count"`
		FailedCount  int    `json:"failed_count"`
		StartTime    *int64 `json:"start_time,omitempty"`
		EndTime      *int64 `json:"end_time,omitempty"`
		Operator     string `json:"operator,omitempty"`
		ErrorLog     string `json:"error_log,omitempty"`
		CreatedAt    int64  `json:"created_at"`
	}
	// GroupHistoryDetail 分组历史详情
	GroupHistoryDetail {
		GroupHistory
		ConfigSnapshot map[string]interface{} `json:"config_snapshot,omitempty"`
	}
)
