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

from __future__ import annotations
from .errorresponse import ErrorResponse, ErrorResponseTypedDict
from postivo_client.types import BaseModel
from postivo_client.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
from typing import Dict, List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


ContactHandling = Literal[
    # Detach contacts from the removed group; keep them in the Address Book.
    "detach",
    # Delete the group and also remove contacts that belong only to this group.
    "delete",
]
r"""How to handle contacts that belong to the group."""


class DeleteGroupRequestTypedDict(TypedDict):
    id: int
    r"""Group `id` to remove."""
    contacts: NotRequired[ContactHandling]
    r"""How to handle contacts that belong to the group."""


class DeleteGroupRequest(BaseModel):
    id: Annotated[
        int, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""Group `id` to remove."""

    contacts: Annotated[
        Optional[ContactHandling],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = "detach"
    r"""How to handle contacts that belong to the group."""


class DeleteGroupResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: ErrorResponseTypedDict


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

    result: ErrorResponse
