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

from __future__ import annotations
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 import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ContributionConstraintsContributionTypeInfoType(
    str, Enum, metaclass=utils.OpenEnumMeta
):
    r"""Retirement contribution type"""

    TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED"
    REGULAR = "REGULAR"
    EMPLOYEE = "EMPLOYEE"
    EMPLOYER = "EMPLOYER"
    RECHARACTERIZATION = "RECHARACTERIZATION"
    ROLLOVER_60_DAY = "ROLLOVER_60_DAY"
    ROLLOVER_DIRECT = "ROLLOVER_DIRECT"
    TRANSFER = "TRANSFER"
    TRUSTEE_FEE = "TRUSTEE_FEE"
    CONVERSION = "CONVERSION"
    REPAYMENT = "REPAYMENT"


class ContributionConstraintsContributionTypeInfoTypedDict(TypedDict):
    r"""Retirement contribution type info"""

    previous_year_allowed: NotRequired[bool]
    r"""Whether this specific retirement contribution may be allowed for the previous year, without consideration of the tax deadline"""
    type: NotRequired[ContributionConstraintsContributionTypeInfoType]
    r"""Retirement contribution type"""


class ContributionConstraintsContributionTypeInfo(BaseModel):
    r"""Retirement contribution type info"""

    previous_year_allowed: Optional[bool] = None
    r"""Whether this specific retirement contribution may be allowed for the previous year, without consideration of the tax deadline"""

    type: Annotated[
        Optional[ContributionConstraintsContributionTypeInfoType],
        PlainValidator(validate_open_enum(False)),
    ] = None
    r"""Retirement contribution type"""
