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

from __future__ import annotations
from ascend_sdk.models.components import (
    cancelorderrequestcreate as components_cancelorderrequestcreate,
    httpmetadata as components_httpmetadata,
    order as components_order,
    status as components_status,
)
from ascend_sdk.types import BaseModel
from ascend_sdk.utils import FieldMetadata, PathParamMetadata, RequestMetadata
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class OrderServiceCancelOrderRequestTypedDict(TypedDict):
    account_id: str
    r"""The account id."""
    order_id: str
    r"""The order id."""
    cancel_order_request_create: (
        components_cancelorderrequestcreate.CancelOrderRequestCreateTypedDict
    )


class OrderServiceCancelOrderRequest(BaseModel):
    account_id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""The account id."""

    order_id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""The order id."""

    cancel_order_request_create: Annotated[
        components_cancelorderrequestcreate.CancelOrderRequestCreate,
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ]


class OrderServiceCancelOrderResponseTypedDict(TypedDict):
    http_meta: components_httpmetadata.HTTPMetadataTypedDict
    order: NotRequired[components_order.OrderTypedDict]
    r"""OK"""
    status: NotRequired[components_status.StatusTypedDict]
    r"""INVALID_ARGUMENT: The account_id or the order_id could not be determined for the request.
    FAILED_PRECONDITION: The order is not in a cancelable state
    """


class OrderServiceCancelOrderResponse(BaseModel):
    http_meta: Annotated[
        Optional[components_httpmetadata.HTTPMetadata], pydantic.Field(exclude=True)
    ] = None

    order: Optional[components_order.Order] = None
    r"""OK"""

    status: Optional[components_status.Status] = None
    r"""INVALID_ARGUMENT: The account_id or the order_id could not be determined for the request.
    FAILED_PRECONDITION: The order is not in a cancelable state
    """
