# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .created_at import CreatedAt
from .customer_number_nullable import CustomerNumberNullable
from .customer_status import CustomerStatus
from .email import Email
from .identifierfields import Identifierfields
from .shippingaddress import Shippingaddress
from .shippingaddressadditional import Shippingaddressadditional
from .shippingcity import Shippingcity
from .shippingcountry import Shippingcountry
from .shippingstate import Shippingstate
from .shippingzip import Shippingzip
from .timezone import Timezone


class CustomerData(UniversalBaseModel):
    """
    Data about a single customer.
    """

    customer_number: typing_extensions.Annotated[
        typing.Optional[CustomerNumberNullable], FieldMetadata(alias="customerNumber")
    ] = None
    customer_username: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="customerUsername")] = (
        pydantic.Field(default=None)
    )
    """
    Customer username for customer portal
    """

    customer_psw: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="customerPsw")] = (
        pydantic.Field(default=None)
    )
    """
    Customer password for customer portal
    """

    customer_status: typing_extensions.Annotated[
        typing.Optional[CustomerStatus], FieldMetadata(alias="customerStatus")
    ] = None
    company: typing.Optional[str] = pydantic.Field(default=None)
    """
    Company name
    """

    firstname: typing.Optional[str] = pydantic.Field(default=None)
    """
    Customer first name
    """

    lastname: typing.Optional[str] = pydantic.Field(default=None)
    """
    Customer last name
    """

    phone: typing.Optional[str] = pydantic.Field(default=None)
    """
    Customer phone number
    """

    email: typing.Optional[Email] = pydantic.Field(default=None)
    """
    Customer email address.
    """

    address: typing.Optional[str] = pydantic.Field(default=None)
    """
    Customer address
    """

    address_1: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="address1")] = pydantic.Field(
        default=None
    )
    """
    Additional customer address
    """

    city: typing.Optional[str] = pydantic.Field(default=None)
    """
    Customer city
    """

    state: typing.Optional[str] = pydantic.Field(default=None)
    """
    Customer State
    """

    zip: typing.Optional[str] = pydantic.Field(default=None)
    """
    Customer postal code
    """

    country: typing.Optional[str] = pydantic.Field(default=None)
    """
    Customer country in ISO-3166-1 alpha 2 format. See https://en.wikipedia.org/wiki/ISO_3166-1 for reference.
    """

    shipping_address: typing_extensions.Annotated[
        typing.Optional[Shippingaddress], FieldMetadata(alias="shippingAddress")
    ] = None
    shipping_address_1: typing_extensions.Annotated[
        typing.Optional[Shippingaddressadditional], FieldMetadata(alias="shippingAddress1")
    ] = None
    shipping_city: typing_extensions.Annotated[typing.Optional[Shippingcity], FieldMetadata(alias="shippingCity")] = (
        None
    )
    shipping_state: typing_extensions.Annotated[
        typing.Optional[Shippingstate], FieldMetadata(alias="shippingState")
    ] = None
    shipping_zip: typing_extensions.Annotated[typing.Optional[Shippingzip], FieldMetadata(alias="shippingZip")] = None
    shipping_country: typing_extensions.Annotated[
        typing.Optional[Shippingcountry], FieldMetadata(alias="shippingCountry")
    ] = None
    balance: typing.Optional[float] = pydantic.Field(default=None)
    """
    Customer balance.
    """

    time_zone: typing_extensions.Annotated[typing.Optional[Timezone], FieldMetadata(alias="timeZone")] = None
    additional_fields: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Optional[str]]], FieldMetadata(alias="additionalFields")
    ] = pydantic.Field(default=None)
    """
    Additional Custom fields in format "key":"value".
    """

    identifier_fields: typing_extensions.Annotated[
        typing.Optional[Identifierfields], FieldMetadata(alias="identifierFields")
    ] = None
    created_at: typing_extensions.Annotated[typing.Optional[CreatedAt], FieldMetadata(alias="createdAt")] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
