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

from __future__ import annotations
from .decimalcreate import DecimalCreate, DecimalCreateTypedDict
from ascend_sdk import utils
from ascend_sdk.types import BaseModel
from ascend_sdk.utils import validate_open_enum
from enum import Enum
from pydantic.functional_validators import PlainValidator
from typing_extensions import Annotated, TypedDict


class LimitPriceCreateType(str, Enum, metaclass=utils.OpenEnumMeta):
    r"""The type of this price, which must be PRICE_PER_UNIT for equity orders, or PERCENTAGE_OF_PAR for fixed income orders."""

    LIMIT_PRICE_TYPE_UNSPECIFIED = "LIMIT_PRICE_TYPE_UNSPECIFIED"
    PRICE_PER_UNIT = "PRICE_PER_UNIT"
    PERCENTAGE_OF_PAR = "PERCENTAGE_OF_PAR"


class LimitPriceCreateTypedDict(TypedDict):
    r"""A limit price definition"""

    price: DecimalCreateTypedDict
    r"""A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][].

    [BigDecimal]:
    https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html
    [decimal.Decimal]: https://docs.python.org/3/library/decimal.html
    """
    type: LimitPriceCreateType
    r"""The type of this price, which must be PRICE_PER_UNIT for equity orders, or PERCENTAGE_OF_PAR for fixed income orders."""


class LimitPriceCreate(BaseModel):
    r"""A limit price definition"""

    price: DecimalCreate
    r"""A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][].

    [BigDecimal]:
    https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html
    [decimal.Decimal]: https://docs.python.org/3/library/decimal.html
    """

    type: Annotated[LimitPriceCreateType, PlainValidator(validate_open_enum(False))]
    r"""The type of this price, which must be PRICE_PER_UNIT for equity orders, or PERCENTAGE_OF_PAR for fixed income orders."""
