"""Shared choices for the different models.""" import ipaddress from typing import Annotated, Any from pydantic import Field, PlainSerializer from pydantic_forms.types import strEnum from typing_extensions import Doc def convert_to_str(value: Any) -> str: """Convert the value to a string.""" return str(value) class Vendor(strEnum): """Enumerator for the different product vendors that are supported.""" JUNIPER = "juniper" NOKIA = "nokia" PortNumber = Annotated[ int, Field( gt=0, le=49151, ), Doc( "Constrained integer for valid port numbers. The range from 49152 to 65535 is marked as ephemeral, " "and can therefore not be selected for permanent allocation." ), ] IPv4AddressType = Annotated[ ipaddress.IPv4Address, PlainSerializer(convert_to_str, return_type=str, when_used="always") ] IPv6AddressType = Annotated[ ipaddress.IPv6Address, PlainSerializer(convert_to_str, return_type=str, when_used="always") ] class ConnectionStrategy(strEnum): """An enumerator for the connection Strategies.""" IN_BAND = "IN BAND" OUT_OF_BAND = "OUT OF BAND"