package netobjgroups

// Information about a version
type RecordVersion struct {
	// Version ID
	VersionID uint64 `json:"version_id"`
}

// List of network object groups
type NetObjGroupList struct {
	Objects []RecordNetObjGroup
}

// Main info about a network object group
type RecordNetObjGroup struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

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

	// Addresses
	Addresses NetAddresses `json:"addresses"`

	// Counters
	Counters Counter `json:"counters"`

	// Created at
	CreatedAt string `json:"created_at"`

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Description
	Description string `json:"description"`

	// External network ports attached to a network object group
	ExternalNetworkPorts ExternalNetworkPorts `json:"external_network_ports"`

	// ID of a network object group
	ID string `json:"id"`

	// L2 connection ports attached to a network object group
	L2ConnectionPorts L2ConnectionPorts `json:"l2_connection_ports"`

	// Logical ports attached to a network object group
	LogicalPorts LogicalPorts `json:"logical_ports"`

	// Name of a network object group
	Name string `json:"name"`

	// Purpose of a network object group
	Purpose string `json:"purpose"`

	// Security policies of a network object group
	SecurityPolicies SecurityPolicies `json:"security_policies"`

	// Type of a network object group
	Type string `json:"type"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// Info about counters
type Counter struct {
	// Amount of addresses
	AddressesCount uint64 `json:"addresses_count"`

	// Amount of L2 connection ports
	L2ConnectionPortsCount uint64 `json:"l2_connection_ports_count"`

	// Amount of logical ports
	LogicalPortsCount uint64 `json:"logical_ports_count"`

	// Amount of security policies
	SecurityPoliciesCount uint64 `json:"security_policies_count"`

	// Amount of security rules
	SecurityRulesCount uint64 `json:"security_rules_count"`
}

// Info about a net address
type NetAddress struct {
	// ID
	ID string `json:"id"`

	// IP address
	IPAddr string `json:"ip_addr"`

	// IP address range end
	IPAddrRangeEnd string `json:"ip_addr_range_end"`

	// IP prefix
	IPPrefix string `json:"ip_prefix"`

	// MAC address
	MACAddr string `json:"mac_addr"`

	// Net address type
	NetAddressType string `json:"net_address_type"`
}

// List of net addresses
type NetAddresses []NetAddress

// Request info about a net address
type NetAddressRequest struct {
	// IP address
	// Required: false
	IPAddr string `url:"ip_addr" json:"ip_addr"`

	// IP address range end
	// Required: false
	IPAddrRangeEnd string `url:"ip_addr_range_end" json:"ip_addr_range_end"`

	// IP prefix
	// Required: false
	IPPrefix string `url:"ip_prefix" json:"ip_prefix"`

	// MAC address
	// Required: false
	MACAddr string `url:"mac_addr" json:"mac_addr"`

	// Net address type
	// Required: true
	NetAddressType string `url:"net_address_type" json:"net_address_type" validate:"required"`
}

// Info about an L2 connection port
type L2ConnectionPort struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

	// Created at
	CreatedAt string `json:"created_at"`

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

	// L2 external network
	L2ExternalNetwork L2ExternalNetwork `json:"l2_external_network"`

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// List of L2 connection ports
type L2ConnectionPorts []L2ConnectionPort

// Info about an L2 external network
type L2ExternalNetwork struct {
	// Bridge network name
	BridgeNetworkName string `json:"bridge_network_name"`

	// Created at
	CreatedAt string `json:"created_at"`

	// Description
	Description string `json:"description"`

	// Display name
	DisplayName string `json:"display_name"`

	// Hypervisors
	Hypervisors []string `json:"hypervisors"`

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

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Version ID
	VersionID uint64 `json:"version_id"`

	// VLAN Tag
	VLANTag *int `json:"vlan_tag"`
}

// Info about an external network port
type ExternalNetworkPort struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

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

	// Bridge network name
	BridgeNetworkName string `json:"bridge_network_name"`

	// Comment
	Comment string `json:"comment"`

	// Default gateway for IPv4
	DefaultGatewayIPv4 string `json:"default_gateway_ipv4"`

	// Default gateway for IPv6
	DefaultGatewayIPv6 string `json:"default_gateway_ipv6"`

	// Description
	Description string `json:"description"`

	// Is a logical port enabled
	Enabled bool `json:"enabled"`

	// Details of external network ports
	ExternalNetworkPorts ExternalNetworkPortsField `json:"external_network_ports"`

	// Hypervisors
	Hypervisors []string `json:"hypervisors"`

	// ID of an external network port
	ID string `json:"id"`

	// IP v4
	IPv4 string `json:"ipv4"`

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

	// Version ID
	VersionID uint64 `json:"version_id"`

	// Subnet for V4
	SubnetV4 string `json:"subnet_v4"`

	// Subnet for V6
	SubnetV6 string `json:"subnet_v6"`

	// Created at
	CreatedAt string `json:"created_at"`

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// VLAN Tag
	VLANTag int `json:"vlan_tag"`

	// MAC
	MAC string `json:"mac"`
}

// List of external network ports
type ExternalNetworkPorts []ExternalNetworkPort

// Info about a logical port
type LogicalPort struct {
	// ID
	ID string `json:"id"`

	// Access group ID
	AccessGroupID string `json:"access_group_id"`

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

	// Adapter MAC
	AdapterMAC string `json:"adapter_mac"`

	// Is address detected
	AddressDetection bool `json:"address_detection"`

	// Description
	Description string `json:"description"`

	// Created at
	CreatedAt string `json:"created_at"`

	// Display name
	DisplayName string `json:"display_name"`

	// Is a logical port enabled
	Enabled bool `json:"enabled"`

	// Exclude firewall settings
	ExcludeFirewall ExcludeFirewall `json:"exclude_firewall"`

	// External network ID
	ExternalNetworkID string `json:"external_network_id"`

	// Hypervisor
	Hypervisor string `json:"hypervisor"`

	// Hypervisor display name
	HypervisorDisplayName string `json:"hypervisor_display_name"`

	// Labels
	Labels Labels `json:"labels"`

	// Live migration target HV
	LiveMigrationTargetHV string `json:"live_migration_target_hv"`

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

	// Bindings
	Bindings Bindings `json:"bindings"`

	// Unique identifier
	UniqueIdentifier string `json:"unique_identifier"`

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// List of logical ports
type LogicalPorts []LogicalPort

// Info about exclude firewall settings
type ExcludeFirewall struct {
	// Exclusion reason
	ExclusionReason string `json:"exclusion_reason"`

	// Is logical port addresses excluded
	LogicalPortAddressesExcluded bool `json:"logical_port_addresses_excluded"`

	// Is logical port excluded
	LogicalPortExcluded bool `json:"logical_port_excluded"`
}

// Labels for a logical port
type Labels struct {
	// VM ID
	VMID string `json:"vm_id"`

	// VM name
	VMName string `json:"vm_name"`
}

// Info about a security policy
type SecurityPolicy struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

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

	// Applied net object groups
	AppliedNetObjectGroups AppliedNetObjectGroups `json:"applied_net_object_groups"`

	// Created at
	CreatedAt string `json:"created_at"`

	// Description
	Description string `json:"description"`

	// Display name
	DisplayName string `json:"display_name"`

	// Is a security policy enabled
	Enabled bool `json:"enabled"`

	// End priority
	EndPriority uint64 `json:"end_priority"`

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

	// Security rules
	SecurityRules SecurityRules `json:"security_rules"`

	// Start priority
	StartPriority uint64 `json:"start_priority"`

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

	// Type
	Type string `json:"type"`

	// Version ID
	VersionID uint64 `json:"version_id"`

	// Updated at
	UpdatedAt string `json:"updated_at"`
}

// List of security policies
type SecurityPolicies []SecurityPolicy

// Info about an applied net object group in a security policy
type AppliedNetObjectGroup struct {
	// ID
	ID string `json:"id"`

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

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// List of applied net object groups
type AppliedNetObjectGroups []AppliedNetObjectGroup

// Details of external network ports field
type ExternalNetworkPortField struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

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

	Comment string `json:"comment"`

	// Display name
	DisplayName string `json:"display_name"`

	// Is a security policy enabled
	Enabled bool `json:"enabled"`

	// IP v4
	IPv4 string `json:"ipv4"`

	// IP v6
	IPv6 string `json:"ipv6"`

	// Config for IP v6
	IPv6Config IPv6Config `json:"ipv6_config"`

	// MAC
	MAC string `json:"mac"`

	// Info about a router gateaway port
	RouterGateawayPort RouterGateawayPort `json:"router_gateaway_port"`

	// Info about a floating IP
	FloatingIP FloatingIP `json:"floating_ip"`
}

// List of external network ports fields
type ExternalNetworkPortsField []ExternalNetworkPortField

// Info about a status
type Status struct {
	// Operation status
	OperationStatus string `json:"operation_status"`

	// Info about hypervisors
	Hypervisors HypervisorsInfo `json:"hypervisors"`

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

// Config for IP v6
type IPv6Config struct {
	// Address mode
	AddressMode string `json:"address_mode"`

	// Is periodic RA enabled
	EnablePeriodicRA bool `json:"enable_periodic_ra"`

	// Interval RA
	IntervalRA uint64 `json:"interval_ra"`

	// Router preference
	RouterPreference string `json:"router_preference"`
}

// Info about a router gateaway port
type RouterGateawayPort struct {
	// Created at
	CreatedAt string `json:"created_at"`

	// Description
	Description string `json:"description"`

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

	// Router display name
	RouterDisplayName string `json:"router_display_name"`

	// Router ID
	RouterID string `json:"router_id"`

	// Is SNAT enabled
	SNATEnabled bool `json:"snat_enabled"`

	// Updated at
	UpdatedAt string `json:"updated_at"`
}

// Info about a floating IP
type FloatingIP struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

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

	// Created at
	CreatedAt string `json:"created_at"`

	// External network port in floating IP
	ExternalNetworkPort ExternalNetworkPortFieldInFloatingIP `json:"external_network_port"`

	// Logical port
	LogicalPort LogicalPort `json:"logical_port"`

	// Router
	Router Router `json:"router"`

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// TODO later
type ExternalNetworkPortFieldInFloatingIP struct{}

// Info about a router
type Router struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

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

	// Created at
	CreatedAt string `json:"created_at"`

	// Description
	Description string `json:"description"`

	// Display name
	DisplayName string `json:"display_name"`

	// Is a security policy enabled
	Enabled bool `json:"enabled"`

	// Gateaway ports
	GateawayPorts GateawayPorts `json:"gateaway_ports"`

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

	// Policies
	Policies Policies `json:"policies"`

	// Port
	Port Ports `json:"ports"`

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

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// Info about bindings
type Bindings struct {
	// ID
	ID string `json:"id"`

	// Segment display name
	SegmentDisplayName string `json:"segment_display_name"`

	// Segment ID
	SegmentID string `json:"segment_id"`

	// Is a port secured
	PortSecurity bool `json:"port_security"`

	// Is an address detected
	AddressDetection bool `json:"address_detection"`

	// Version ID
	VersionID uint64 `json:"version_id"`

	// Created at
	CreatedAt string `json:"created_at"`

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Logical port addresses
	LogicalPortAddresses LogicalPortAddresses `json:"logical_port_addresses"`
}

// Info about a gateaway port
type GateawayPort struct {
	// Created at
	CreatedAt string `json:"created_at"`

	// Description
	Description string `json:"description"`

	// Max external L4 port
	ExternalL4PortMax uint64 `json:"external_l4_port_max"`

	// Min external L4 port
	ExternalL4PortMin uint64 `json:"external_l4_port_min"`

	// External network port in floating IP
	ExternalNetworkPortFieldInFloatingIP ExternalNetworkPortFieldInFloatingIP `json:"external_network_port"` // to check

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

	// Is SNAT enabled
	SNATEnabled bool `json:"snat_enabled"`

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

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// List of gateaway ports
type GateawayPorts []GateawayPort

// Info about a policy
type Policy struct {
	// Action
	Action string `json:"action"`

	// Created at
	CreatedAt string `json:"created_at"`

	// Display name
	DisplayName string `json:"display_name"`

	// Is a security policy enabled
	Enabled bool `json:"enabled"`

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

	// Match
	Match string `json:"match"`

	// List of next IP v4 addresses
	NextIPv4Address []string `json:"next_ipv4_address"`

	// List of next IP v6 addresses
	NextIPv6Address []string `json:"next_ipv6_address"`

	// Priority
	Priority int `json:"priority"`

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// List of policies
type Policies []Policy

// Info about a port
type Port struct {
	// Created at
	CreatedAt string `json:"created_at"`

	// Description
	Description string `json:"description"`

	// Is a security policy enabled
	Enabled bool `json:"enabled"`

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

	// IPv4 address
	IPv4Address string `json:"ipv4_address"`

	// IPv6 address
	IPv6Address string `json:"ipv6_address"`

	// Config for IPv6
	IPv6Config IPv6Config `json:"ipv6_config"`

	// MAC
	MAC string `json:"mac"`

	// Segment
	Segment Segment `json:"segment"`

	// Segment ID
	SegmentID string `json:"segment_id"`

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

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// VersionID
	VersionID uint64 `json:"version_id"`
}

// List of ports
type Ports []Port

// Info about a segment
type Segment struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

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

	// Created at
	CreatedAt string `json:"created_at"`

	// Description
	Description string `json:"description"`

	DHCPv4 DHCPv4 `json:"dhcp_v4"`
	DHCPv6 DHCPv6 `json:"dhcp_v6"`

	// Display name
	DisplayName string `json:"display_name"`

	// Is a security policy enabled
	Enabled bool `json:"enabled"`

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

	// Info about logical ports
	LogicalPortsInfo LogicalPortsInfo `json:"logical_ports_info"`

	// Info about routers
	RoutersInfo RoutersInfo `json:"routers_info"`

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

	// Subnet v4
	SubnetV4 string `json:"subnet_v4"`

	// Subnet v6
	SubnetV6 string `json:"subnet_v6"`

	// Updated at
	UpdatedAt string `json:"updated_at"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// Info about DHCP v4
type DHCPv4 struct {
	// List of DNS
	DNS []string `json:"dns"`

	// List of excluded address ranges
	ExcludedAddressRanges []string `json:"excluded_address_ranges"`

	// Gateaway
	Gateaway string `json:"gateaway"`

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

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

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

	// is there a server MAC
	ServerMAC bool `json:"server_mac"`

	// Is a security policy enabled
	Enabled bool `json:"enabled"`
}

// Info about DHCP v6
type DHCPv6 struct {
	// Address prefix
	AddressPrefix string `json:"address_prefix"`

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

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

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

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

	// Is a security policy enabled
	Enabled bool `json:"enabled"`
}

// Info about logical ports
type LogicalPortsInfo struct {
	// Display name
	DisplayName string `json:"display_name"`

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

// Info about routers
type RoutersInfo struct {
	// Display name
	DisplayName string `json:"display_name"`

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

// Info about a hypervisor
type HypervisorInfo struct {
	// Operation status
	OperationStatus string `json:"operation_status"`

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

	// Display name
	DisplayName string `json:"display_name"`

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

	// Synced at
	SyncedAt string `json:"synced_at"`
}

// List of hypervisors info
type HypervisorsInfo []HypervisorInfo

type LogicalPortAddress struct {
	// IP
	IP string `json:"ip"`

	// IP Type
	IPType string `json:"ip_type"`

	// Is logical port address discovered
	IsDiscovered bool `json:"is_discovered"`

	// Is logical port address primary
	IsPrimary bool `json:"is_primary"`

	// MAC
	MAC string `json:"mac"`

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

	// Logical port ID
	LogicalPortID string `json:"logical_port_id"`

	// Assigned at
	AssignedAt string `json:"assigned_at"`
}

// List of logical port addresses
type LogicalPortAddresses []LogicalPortAddress

// Info about a security rule
type SecurityRule struct {
	// Access group ID
	AccessGroupID string `json:"access_group_id"`

	// Action
	Action string `json:"action"`

	// Description
	Description string `json:"description"`

	// Destination net object
	DestinationNetObject *SecurityRuleNetObject `json:"destination_net_object"`

	// Direction
	Direction string `json:"direction"`

	// Display name
	DisplayName string `json:"display_name"`

	// Is enabled
	Enabled bool `json:"enabled"`

	// Filter
	Filter *SecurityRuleFilter `json:"filter"`

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

	// Is log enabled
	LogEnabled bool `json:"log_enabled"`

	// Log name
	LogName string `json:"log_name"`

	// Log severity
	LogSeverity string `json:"log_severity"`

	// Priority
	Priority int `json:"priority"`

	// Security policy ID
	SecurityPolicyID string `json:"security_policy_id"`

	// Source net object
	SourceNetObject *SecurityRuleNetObject `json:"source_net_object"`

	// Is statistics enabled
	StatisticsEnabled bool `json:"statistics_enabled"`

	// Type
	Type string `json:"type"`

	// Version ID
	VersionID uint64 `json:"version_id"`
}

// List of security rules
type SecurityRules []SecurityRule

// Info about a security rule net object
type SecurityRuleNetObject struct {
	// Display name
	DisplayName string `json:"display_name"`

	// Net address pool ID
	NetAddressPoolID string `json:"net_address_pool_id"`

	// Net object group ID
	NetObjectGroupID string `json:"net_object_group_id"`
}

// Info about a security rule filter
type SecurityRuleFilter struct {
	// Filters
	Filters SecurityRuleFilters `json:"filters"`

	// Name
	Name string `json:"name"`
}

// Security rule filters
type SecurityRuleFilters struct {
	// Filter all traffic
	All bool `json:"all"`

	// Filter ARP traffic
	ARP bool `json:"arp"`

	// Filter DHCP traffic
	DHCP bool `json:"dhcp"`

	// Custom filter expression
	Expression string `json:"expression"`

	// Filter ICMP traffic
	ICMP bool `json:"icmp"`

	// Filter IP traffic
	IP bool `json:"ip"`

	// Filter IPv4 traffic
	IPv4 bool `json:"ip_v4"`

	// Filter IPv6 traffic
	IPv6 bool `json:"ip_v6"`

	// Keep tracking opened sessions
	KeepOpenedSessions bool `json:"keep_opened_sessions"`

	// Filter Neighbor Discovery traffic
	ND bool `json:"nd"`

	// Filter TCP traffic
	TCP bool `json:"tcp"`

	// List of TCP destination ports to filter
	TCPDstPorts []string `json:"tcp_dst_ports"`

	// Filter UDP traffic
	UDP bool `json:"udp"`

	// List of UDP destination ports to filter
	UDPDstPorts []string `json:"udp_dst_ports"`
}
