package segments

import "time"

// List segments
type ListSegment []SegmentResponse

// Main information about network segment
type SegmentResponse struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

	// Access group name
	AccessGroupName string `json:"access_group_name"`

	// Created time
	CreatedAt time.Time `json:"created_at"`

	// Detailed description of the router port
	Description string `json:"description"`

	// DHCP IPv4
	DHCPv4 DHCPv4Config `json:"dhcp_v4"`

	// DHCP IPv6
	DHCPv6 DHCPv6Config `json:"dhcp_v6"`

	// User-friendly name for the segment
	DisplayName string `json:"display_name"`

	// Whether the segment is enabled
	Enabled bool `json:"enabled"`

	// ID of segment
	ID string `json:"id"`

	// Logical ports info
	LogicalPortsInfo []EntityInfo `json:"logical_ports_info"`

	// Routers info
	RoutersInfo []EntityInfo `json:"routers_info"`

	// Status
	Status Status `json:"status"`

	// IPv4 subnet in CIDR notation
	SubnetV4 string `json:"subnet_v4"`

	// IPv6 subnet in CIDR notation
	SubnetV6 string `json:"subnet_v6"`

	// Update time
	UpdatedAt time.Time `json:"updated_at"`

	// ID of version
	VersionID uint64 `json:"version_id"`
}

type DHCPv4Config struct {
	// DNS
	DNS []string `json:"dns"`

	// Excluded address ranges
	ExcludedAddressRanges []string `json:"excluded_address_ranges"`

	// Gateway
	Gateway string `json:"gateway"`

	// ID of config
	ID string `json:"id"`

	// Lease time
	LeaseTime uint64 `json:"lease_time"`

	// Server IP
	ServerIP string `json:"server_ip"`

	// Server MAC
	ServerMAC string `json:"server_mac"`

	// Whether the config is enabled
	Enabled bool `json:"enabled"`
}

type DHCPv6Config struct {
	// Address prefix
	AddressPrefix string `json:"address_prefix"`

	// DNS
	DNS []string `json:"dns"`

	// ID of config
	ID string `json:"id"`

	// Lease time
	LeaseTime uint64 `json:"lease_time"`

	// Server MAC
	ServerMAC string `json:"server_mac"`

	// Whether the config is enabled
	Enabled bool `json:"enabled"`
}

type EntityInfo struct {
	// User-friendly name for entity
	DisplayName string `json:"display_name"`

	// ID of entity
	ID string `json:"id"`
}

type Status struct {
	// Common
	Common string `json:"common"`

	// Hypervisors status
	Hypervisors []HypervisorStatus `json:"hypervisors"`
}

type HypervisorStatus struct {
	// Status
	Status string `json:"status"`

	// Name of hypervisor
	Name string `json:"name"`

	// User-friendly name for the hypervisor
	DisplayName string `json:"display_name"`

	// Hypervisor status
	HypervisorStatus string `json:"hypervisor_status"`

	// Synced time
	SyncedAt time.Time `json:"synced_at"`
}
