"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .channelsettingsdto import ChannelSettingsDto
from dataclasses import dataclass, field
import httpx
from novu_py.models import NovuError
from novu_py.types import BaseModel, OptionalNullable, UNSET
import pydantic
from typing import Any, Dict, List, Optional
from typing_extensions import Annotated


class SubscriberResponseDtoErrorData(BaseModel):
    subscriber_id: Annotated[str, pydantic.Field(alias="subscriberId")]
    r"""The identifier used to create this subscriber, which typically corresponds to the user ID in your system."""
    organization_id: Annotated[str, pydantic.Field(alias="_organizationId")]
    r"""The unique identifier of the organization to which the subscriber belongs."""
    environment_id: Annotated[str, pydantic.Field(alias="_environmentId")]
    r"""The unique identifier of the environment associated with this subscriber."""
    deleted: bool
    r"""Indicates whether the subscriber has been deleted."""
    created_at: Annotated[str, pydantic.Field(alias="createdAt")]
    r"""The timestamp indicating when the subscriber was created, in ISO 8601 format."""
    updated_at: Annotated[str, pydantic.Field(alias="updatedAt")]
    r"""The timestamp indicating when the subscriber was last updated, in ISO 8601 format."""
    id: Annotated[Optional[str], pydantic.Field(alias="_id")] = None
    r"""The internal ID generated by Novu for your subscriber. This ID does not match the `subscriberId` used in your queries. Refer to `subscriberId` for that identifier."""
    first_name: Annotated[OptionalNullable[str], pydantic.Field(alias="firstName")] = (
        UNSET
    )
    r"""The first name of the subscriber."""
    last_name: Annotated[OptionalNullable[str], pydantic.Field(alias="lastName")] = (
        UNSET
    )
    r"""The last name of the subscriber."""
    email: OptionalNullable[str] = UNSET
    r"""The email address of the subscriber."""
    phone: OptionalNullable[str] = UNSET
    r"""The phone number of the subscriber."""
    avatar: OptionalNullable[str] = UNSET
    r"""The URL of the subscriber's avatar image."""
    locale: OptionalNullable[str] = UNSET
    r"""The locale setting of the subscriber, indicating their preferred language or region."""
    channels: Optional[List[ChannelSettingsDto]] = None
    r"""An array of channel settings associated with the subscriber."""
    topics: Annotated[
        Optional[List[str]],
        pydantic.Field(
            deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
        ),
    ] = None
    r"""An array of topics that the subscriber is subscribed to."""
    is_online: Annotated[OptionalNullable[bool], pydantic.Field(alias="isOnline")] = (
        UNSET
    )
    r"""Indicates whether the subscriber is currently online."""
    last_online_at: Annotated[
        OptionalNullable[str], pydantic.Field(alias="lastOnlineAt")
    ] = UNSET
    r"""The timestamp indicating when the subscriber was last online, in ISO 8601 format."""
    v: Annotated[Optional[float], pydantic.Field(alias="__v")] = None
    r"""The version of the subscriber document."""
    data: OptionalNullable[Dict[str, Any]] = UNSET
    r"""Additional custom data for the subscriber"""
    timezone: OptionalNullable[str] = UNSET
    r"""Timezone of the subscriber"""


@dataclass(unsafe_hash=True)
class SubscriberResponseDtoError(NovuError):
    data: SubscriberResponseDtoErrorData = field(hash=False)

    def __init__(
        self,
        data: SubscriberResponseDtoErrorData,
        raw_response: httpx.Response,
        body: Optional[str] = None,
    ):
        message = body or raw_response.text
        super().__init__(message, raw_response, body)
        object.__setattr__(self, "data", data)
