# This file was auto-generated by Fern from our API Definition.

from ...core.pydantic_utilities import UniversalBaseModel
from .contract_job_id import ContractJobId
import pydantic
from .contract_job_status import ContractJobStatus
import typing
from .contract_response import ContractResponse
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class GenerateContractAsyncJobResponse(UniversalBaseModel):
    """
    Examples
    --------
    import datetime

    from mercoa.commons import Address, PhoneNumber
    from mercoa.contract_types import (
        ContractInvoiceLineItemSchema,
        ContractInvoiceSchema,
        ContractRecurrenceResponse,
        ContractResponse,
        GenerateContractAsyncJobResponse,
    )
    from mercoa.entity_types import (
        BusinessProfileResponse,
        CounterpartyCustomizationAccount,
        CounterpartyResponse,
        Ein,
        ProfileResponse,
        TaxId,
    )
    from mercoa.payment_method_types import PaymentMethodResponse_BankAccount

    GenerateContractAsyncJobResponse(
        job_id="cntgen_d6734204-ae46-4fe9-a0c5-bd2763d40c9b",
        status="success",
        contract=ContractResponse(
            id="cnt_3bd62b69-3835-433e-829f-4388a2e46c41",
            summary="Contract Start Date: January 29, 2025\nParties to the Agreement:\n- Provider (Vendor): [Vendor Name] - Client (Payer): [Client Name]\nFees and Payment Terms:\n- Monthly Recurring Fee: \\$20.00 - Payment Schedule: Fees are payable in advance on the 1st day of each month. - First Payment Date: February 1, 2025 - Payment Method: Via credit card to the account designated by Provider. - Payment Due Date: Payment is due 5 days after the invoice date.\n",
            recurrences=[
                ContractRecurrenceResponse(
                    id="cntrec_0b2d48a7-38e8-44e1-9abc-95e0e67eb484",
                    contract_id="cnt_3bd62b69-3835-433e-829f-4388a2e46c41",
                    rrule="DTSTART:20250201T000000ZRRULE:FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=1",
                    justification="Monthly recurring fee billed in advance on the 1st of each month",
                    filtered_contract_summary="Contract Start Date: January 29, 2025\nParties to the Agreement:\n- Provider (Vendor): [Vendor Name] - Client (Payer): [Client Name]\nFees and Payment Terms:\n- Monthly Recurring Fee: \\$20.00 - Payment Schedule: Fees are payable in advance on the 1st day of each month. - First Payment Date: February 1, 2025 - Payment Method: Via credit card to the account designated by Provider. - Payment Due Date: Payment is due 5 days after the invoice date.\n",
                    invoice_schema=ContractInvoiceSchema(
                        line_items=[
                            ContractInvoiceLineItemSchema(
                                name="Monthly Subscription Service Fee",
                                unit_price=20.0,
                                currency="USD",
                                quantity=1.0,
                            )
                        ],
                    ),
                    created_invoice_ids=["in_8545a84e-a45f-41bf-bdf1-33b42a55812c"],
                    created_at=datetime.datetime.fromisoformat(
                        "2025-01-29 00:00:00+00:00",
                    ),
                    updated_at=datetime.datetime.fromisoformat(
                        "2025-01-29 00:00:00+00:00",
                    ),
                )
            ],
            next_invoice_date=datetime.date.fromisoformat(
                "2025-03-01",
            ),
            creator_entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
            payer_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
            payer=CounterpartyResponse(
                id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
                foreign_id="MY-DB-ID-12345",
                name="Acme Inc.",
                email="customer@acme.com",
                accepted_tos=True,
                status="verified",
                is_customer=True,
                is_payor=True,
                is_payee=False,
                is_network_payor=False,
                is_network_payee=False,
                account_type="business",
                updated_at=datetime.datetime.fromisoformat(
                    "2024-01-02 00:00:00+00:00",
                ),
                created_at=datetime.datetime.fromisoformat(
                    "2024-01-01 00:00:00+00:00",
                ),
                profile=ProfileResponse(
                    business=BusinessProfileResponse(
                        email="customer@acme.com",
                        legal_business_name="Acme Inc.",
                        business_type="llc",
                        phone=PhoneNumber(
                            country_code="1",
                            number="4155551234",
                        ),
                        address=Address(
                            address_line_1="123 Main St",
                            address_line_2="Unit 1",
                            city="San Francisco",
                            state_or_province="CA",
                            postal_code="94105",
                            country="US",
                        ),
                        tax_id_provided=True,
                        tax_id=TaxId(
                            ein=Ein(
                                number="12-3456789",
                            ),
                        ),
                        owners_provided=True,
                    ),
                ),
                accounts=[
                    CounterpartyCustomizationAccount(
                        account_id="85866843",
                        postal_code="94105",
                        name_on_account="John Doe",
                    )
                ],
                payment_methods=[
                    PaymentMethodResponse_BankAccount(
                        id="pm_4794d597-70dc-4fec-b6ec-c5988e759769",
                        account_name="My Checking Account",
                        bank_name="Chase",
                        routing_number="12345678",
                        account_number="99988767623",
                        account_type="CHECKING",
                        status="VERIFIED",
                        is_default_source=True,
                        is_default_destination=True,
                        supported_currencies=["USD"],
                        metadata={},
                        frozen=False,
                        created_at=datetime.datetime.fromisoformat(
                            "2021-01-01 00:00:00+00:00",
                        ),
                        updated_at=datetime.datetime.fromisoformat(
                            "2021-01-01 00:00:00+00:00",
                        ),
                    )
                ],
                counterparty_type=["ENTITY"],
            ),
            vendor_id="ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
            vendor=CounterpartyResponse(
                id="ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
                foreign_id="MY-DB-ID-90909",
                name="Big Box Store",
                email="vendor@bigboxstore.com",
                accepted_tos=False,
                status="unverified",
                is_customer=False,
                is_payor=False,
                is_payee=True,
                is_network_payor=False,
                is_network_payee=False,
                account_type="business",
                updated_at=datetime.datetime.fromisoformat(
                    "2024-01-02 00:00:00+00:00",
                ),
                created_at=datetime.datetime.fromisoformat(
                    "2024-01-01 00:00:00+00:00",
                ),
                profile=ProfileResponse(
                    business=BusinessProfileResponse(
                        email="vendor@bigboxstore.com",
                        legal_business_name="Big Box Store",
                        business_type="publicCorporation",
                        tax_id_provided=False,
                        owners_provided=False,
                    ),
                ),
                payment_methods=[
                    PaymentMethodResponse_BankAccount(
                        id="pm_7610541f-4619-4033-8620-cfccfb811293",
                        account_name="Vendor Checking Account",
                        bank_name="Chase",
                        routing_number="66554433",
                        account_number="55934059697648",
                        account_type="CHECKING",
                        status="NEW",
                        is_default_source=True,
                        is_default_destination=True,
                        supported_currencies=["USD"],
                        metadata={},
                        frozen=False,
                        created_at=datetime.datetime.fromisoformat(
                            "2021-01-01 00:00:00+00:00",
                        ),
                        updated_at=datetime.datetime.fromisoformat(
                            "2021-01-01 00:00:00+00:00",
                        ),
                    )
                ],
                counterparty_type=["ENTITY"],
            ),
            created_at=datetime.datetime.fromisoformat(
                "2025-01-29 00:00:00+00:00",
            ),
            updated_at=datetime.datetime.fromisoformat(
                "2025-02-01 00:00:00+00:00",
            ),
        ),
    )
    """

    job_id: ContractJobId = pydantic.Field(alias="jobId")
    """
    Job ID
    """

    status: ContractJobStatus = pydantic.Field()
    """
    Job status
    """

    contract: typing.Optional[ContractResponse] = pydantic.Field(default=None)
    """
    Contract
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
