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

from __future__ import annotations
from .depositscheduledetailscreate import (
    DepositScheduleDetailsCreate,
    DepositScheduleDetailsCreateTypedDict,
)
from .scheduledretirementcontributioncreate import (
    ScheduledRetirementContributionCreate,
    ScheduledRetirementContributionCreateTypedDict,
)
from ascend_sdk import utils
from ascend_sdk.types import BaseModel
from ascend_sdk.utils import validate_open_enum
from enum import Enum
import pydantic
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict, deprecated


class AchDepositScheduleCreateType(str, Enum, metaclass=utils.OpenEnumMeta):
    r"""The type of retirement contribution."""

    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"


@deprecated(
    "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
)
class IraContributionTypedDict(TypedDict):
    r"""The ira contribution info for an IRA account. Deprecated, see retirement_contribution_details"""

    tax_year: int
    r"""Tax year for which the contribution is applied. Current year is always valid; prior year is only valid before tax deadline. Must be in \"YYYY\" format."""
    type: AchDepositScheduleCreateType
    r"""The type of retirement contribution."""


@deprecated(
    "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
)
class IraContribution(BaseModel):
    r"""The ira contribution info for an IRA account. Deprecated, see retirement_contribution_details"""

    tax_year: int
    r"""Tax year for which the contribution is applied. Current year is always valid; prior year is only valid before tax deadline. Must be in \"YYYY\" format."""

    type: Annotated[
        AchDepositScheduleCreateType, PlainValidator(validate_open_enum(False))
    ]
    r"""The type of retirement contribution."""


class AchDepositScheduleCreateTypedDict(TypedDict):
    r"""A deposit transfer schedule using the ACH mechanism"""

    bank_relationship: str
    r"""The name of the bank relationship to be used in the ACH transaction"""
    schedule_details: DepositScheduleDetailsCreateTypedDict
    r"""Details of deposit schedule transfers"""
    ira_contribution: NotRequired[IraContributionTypedDict]
    r"""The ira contribution info for an IRA account. Deprecated, see retirement_contribution_details"""
    retirement_contribution: NotRequired[ScheduledRetirementContributionCreateTypedDict]
    r"""The retirement contribution details for a scheduled deposit"""


class AchDepositScheduleCreate(BaseModel):
    r"""A deposit transfer schedule using the ACH mechanism"""

    bank_relationship: str
    r"""The name of the bank relationship to be used in the ACH transaction"""

    schedule_details: DepositScheduleDetailsCreate
    r"""Details of deposit schedule transfers"""

    ira_contribution: Annotated[
        Optional[IraContribution],
        pydantic.Field(
            deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
        ),
    ] = None
    r"""The ira contribution info for an IRA account. Deprecated, see retirement_contribution_details"""

    retirement_contribution: Optional[ScheduledRetirementContributionCreate] = None
    r"""The retirement contribution details for a scheduled deposit"""
