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

import datetime as dt
import typing

from ..core.datetime_utils import serialize_datetime
from .basal_body_temperature_entry import BasalBodyTemperatureEntry
from .cervical_mucus_entry import CervicalMucusEntry
from .client_facing_source import ClientFacingSource
from .contraceptive_entry import ContraceptiveEntry
from .detected_deviation_entry import DetectedDeviationEntry
from .home_pregnancy_test_entry import HomePregnancyTestEntry
from .home_progesterone_test_entry import HomeProgesteroneTestEntry
from .intermenstrual_bleeding_entry import IntermenstrualBleedingEntry
from .menstrual_flow_entry import MenstrualFlowEntry
from .ovulation_test_entry import OvulationTestEntry
from .sexual_activity_entry import SexualActivityEntry

try:
    import pydantic.v1 as pydantic  # type: ignore
except ImportError:
    import pydantic  # type: ignore


class MenstrualCycle(pydantic.BaseModel):
    period_start: str
    period_end: typing.Optional[str]
    cycle_end: typing.Optional[str]
    is_predicted: typing.Optional[bool]
    menstrual_flow: typing.Optional[typing.List[MenstrualFlowEntry]]
    cervical_mucus: typing.Optional[typing.List[CervicalMucusEntry]]
    intermenstrual_bleeding: typing.Optional[typing.List[IntermenstrualBleedingEntry]]
    contraceptive: typing.Optional[typing.List[ContraceptiveEntry]]
    detected_deviations: typing.Optional[typing.List[DetectedDeviationEntry]]
    ovulation_test: typing.Optional[typing.List[OvulationTestEntry]]
    home_pregnancy_test: typing.Optional[typing.List[HomePregnancyTestEntry]]
    home_progesterone_test: typing.Optional[typing.List[HomeProgesteroneTestEntry]]
    sexual_activity: typing.Optional[typing.List[SexualActivityEntry]]
    basal_body_temperature: typing.Optional[typing.List[BasalBodyTemperatureEntry]]
    source: ClientFacingSource

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().dict(**kwargs_with_defaults)

    class Config:
        frozen = True
        smart_union = True
        json_encoders = {dt.datetime: serialize_datetime}
