from datetime import datetime
from typing import Optional
from pydantic import Field
from src.apps.base.schemas.common import BaseSchema


# Shared properties
class PaymentLinkBase(BaseSchema):
    link: Optional[str] = Field(description="Link where the payment will be made")
    is_expired: Optional[bool] = Field(
        description="Denotes if the link has expred or not"
    )
    token: Optional[str] = Field(description="Token for the link")
    start_date: Optional[datetime] = Field(
        description="Start date and time of the checkout effective dates"
    )
    end_date: Optional[datetime] = Field(
        description="End date and time of the checkout effective dates"
    )


class PaymentLinkSchema(PaymentLinkBase):
    id: int = Field(description="Id of PaymentLink resource")
    full_url: Optional[str] = Field(description="Full Absolute URL of the payment link")


class PaymentLinkCreateRequestSchema(PaymentLinkBase):
    payment_request_id: Optional[int] = Field(
        description="Internal ID of the payment request"
    )
    contract_id: Optional[int] = Field(description="Contract id of the contract")
    invoice_id: Optional[int] = Field(description="Invoice id of the invoice")


class PaymentLinkUpdateRequestSchema(PaymentLinkBase):
    pass
