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

from __future__ import annotations
from .createupdatetopicrequestdto import (
    CreateUpdateTopicRequestDto,
    CreateUpdateTopicRequestDtoTypedDict,
)
from .topicresponsedto import TopicResponseDto, TopicResponseDtoTypedDict
from novu_py.types import BaseModel
from novu_py.utils import (
    FieldMetadata,
    HeaderMetadata,
    QueryParamMetadata,
    RequestMetadata,
)
import pydantic
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class TopicsControllerUpsertTopicRequestTypedDict(TypedDict):
    create_update_topic_request_dto: CreateUpdateTopicRequestDtoTypedDict
    fail_if_exists: NotRequired[bool]
    r"""If true, the request will fail if a topic with the same key already exists"""
    idempotency_key: NotRequired[str]
    r"""A header for idempotency purposes"""


class TopicsControllerUpsertTopicRequest(BaseModel):
    create_update_topic_request_dto: Annotated[
        CreateUpdateTopicRequestDto,
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ]

    fail_if_exists: Annotated[
        Optional[bool],
        pydantic.Field(alias="failIfExists"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""If true, the request will fail if a topic with the same key already exists"""

    idempotency_key: Annotated[
        Optional[str],
        pydantic.Field(alias="idempotency-key"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""A header for idempotency purposes"""


class TopicsControllerUpsertTopicResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: TopicResponseDtoTypedDict


class TopicsControllerUpsertTopicResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: TopicResponseDto
