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

from ...core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .contract_recurrence_create_request import ContractRecurrenceCreateRequest
from ...entity_types.types.entity_id import EntityId
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class ContractUpdateRequest(UniversalBaseModel):
    """
    Examples
    --------
    from mercoa.contract_types import (
        ContractInvoiceLineItemSchema,
        ContractInvoiceSchema,
        ContractRecurrenceCreateRequest,
        ContractUpdateRequest,
    )

    ContractUpdateRequest(
        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=[
            ContractRecurrenceCreateRequest(
                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,
                        )
                    ],
                ),
            )
        ],
    )
    """

    summary: typing.Optional[str] = pydantic.Field(default=None)
    """
    Natural language summary of the contract
    """

    recurrences: typing.Optional[typing.List[ContractRecurrenceCreateRequest]] = pydantic.Field(default=None)
    """
    Recurrences defining the contract's fee schedule. Please note that setting this will overwrite all existing recurrences.
    """

    creator_entity_id: typing.Optional[EntityId] = pydantic.Field(alias="creatorEntityId", default=None)
    """
    ID of the entity that created the contract
    """

    payer_id: typing.Optional[EntityId] = pydantic.Field(alias="payerId", default=None)
    """
    ID of the payer entity for this contract
    """

    vendor_id: typing.Optional[EntityId] = pydantic.Field(alias="vendorId", default=None)
    """
    ID of the vendor entity for this 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
