from __future__ import annotations
import datetime
from collections.abc import Callable
from dataclasses import dataclass, field
from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter
from typing import Any, Optional, TYPE_CHECKING, Union
from uuid import UUID

@dataclass
class WithRequestGetResponse(Parsable):
    # The account ID.
    account_id: Optional[UUID] = None
    # The callback URL specified for the data request. If specified, the Data Connection service calls the URL each time a job executes for the request. The service sends a POST request that provides job execution information. The JSON payload in the POST request contains the following: ``{ ``accountId``: ``account_id``, ``requestId``: ``request_id``, ``jobId``: ``data_connector_job_id``, ``state``: ``complete``, ``success``: true or false }``.
    callback_url: Optional[str] = None
    # The date and time the data request was created, presented in ISO 8601 format.
    created_at: Optional[datetime.datetime] = None
    # The BIM 360 / ACC user ID of the user who created the data request.
    created_by: Optional[str] = None
    # The email address of the user who created the data request.
    created_by_email: Optional[str] = None
    # The timeframe used for extracting data in the request. Currently, it is applicable only to the Activities service. This field contains the value specified in the request, indicating the range of data included in the response. Possible values:- ``TODAY``: Data for the current day (from 00:00 UTC to the time the request was made).- ``YESTERDAY``: Data for the previous calendar day (from 00:00 UTC to 23:59 UTC).- ``PAST_7_DAYS``: Data for the last 7 days, including the current day.- ``MONTH_TO_DATE``: Data from the start of the current calendar month (00:00 UTC on the 1st) to the time the request was made.- ``LAST_MONTH``: Data for the entire previous calendar month (00:00 UTC on the 1st to 23:59 UTC on the last day).
    date_range: Optional[str] = None
    # The user-entered description of this data request. If not supplied, the default value is a null string.
    description: Optional[str] = None
    # The date and time when a one-time job execution or a recurring interval schedule begins, presented in ISO 8601 format.
    effective_from: Optional[datetime.datetime] = None
    # The date and time when the recurring interval schedule ends, presented in ISO 8601 format.
    effective_to: Optional[datetime.datetime] = None
    # The end date and time for the data extraction, in ISO 8601 format.This field applies only to schemas supporting date range extraction. The detailed schema documentation delivered with each data extract identifies the schemas and tables that support date range extraction.Additional notes on using ``startDate`` and ``endDate``:- If you provide only ``startDate`` or ``endDate`` (but not both), Data Connector uses that single date for both ``startDate`` and ``endDate``.- If you request more than the Maximum Date Range Allowed for an extraction, the default date range as documented in the schema documentation is returned.- For the ``activities`` service group, data replication can be delayed up to 20 minutes, so your requests should account for that delay.
    end_date: Optional[str] = None
    # The ID of the data request.
    id: Optional[UUID] = None
    # The data request's active/inactive status. Possible values: ``true`` the request is active; ``false`` the request is inactive.
    is_active: Optional[bool] = None
    # The date and time the last job for this data request was scheduled to execute, presented in ISO 8601 format.
    last_queued_at: Optional[datetime.datetime] = None
    # (Legacy): A single project ID for the data request. Superseded by ``projectIdList``.
    project_id: Optional[UUID] = None
    # A list of up to 50 project IDs included in the data request. This field contains the project IDs for which data is being extracted. If both ``projectId`` and ``projectIdList`` were included in the request, this field contains the values from ``projectIdList``.
    project_id_list: Optional[list[str]] = None
    # The types of projects to be included in a request. The possible values are:- ``all``: - all projects (default)- ``archived``: archived projects only- ``active``: active project only
    project_status: Optional[str] = None
    # The number of ``scheduleInterval`` units to wait between job execution for the request. For example, a ``scheduleInterval`` value of ``WEEK`` and a ``reoccuringInterval`` value of ``2`` means the job will run every two weeks.
    reoccuring_interval: Optional[int] = None
    # The scheduling interval unit for jobs spawned by this data request. This value is multiplied by the ``reoccurringInterval`` attribute to specify the length of the recurring interval at which jobs run. Possible values:- ``ONE_TIME``: Run the job only once- ``DAY``: Set the recurring job interval in days- ``WEEK``: Set the recurring job interval in weeks- ``MONTH``: Set the recurring job interval in months- ``YEAR``: Set the recurring job interval in years
    schedule_interval: Optional[str] = None
    # Send a notification email to the user upon job completion. Values: true or false (default is true)
    send_email: Optional[bool] = None
    # The service groups from which data has been extracted, separated by commas.Possible values: ``all``, ``activities``, ``admin``, ``assets``, ``checklists``, ``cost``, ``dailylogs``, ``forms``, ``iq``, ``issues``, ``locations``, ``markups``, ``meetingminutes``, ``photos``, ``relationships``, ``reviews``, ``rfis``, ``schedule``, ``sheets``, ``submittals``, ``submittalsacc``, ``transmittals``.Note that the ``admin`` service includes both project and account admin, and ``all`` indicates that the extract contains all currently available service groups.
    service_groups: Optional[list[str]] = None
    # The start date and time for the data extraction, in ISO 8601 format.This field applies only to schemas supporting date range extraction. The detailed schema documentation delivered with each data extract identifies the schemas and tables that support date range extraction.Additional notes on using ``startDate`` and ``endDate``:- If you provide only ``startDate`` or ``endDate`` (but not both), Data Connector uses that single date for both ``startDate`` and ``endDate``.- If you request more than the Maximum Date Range Allowed for an extraction, the default date range as documented in the schema documentation is returned.- For the ``activities`` service group, data replication can be delayed up to 20 minutes, so your requests should account for that delay.
    start_date: Optional[str] = None
    # The date and time the data request was last updated, presented in ISO 8601 format.
    updated_at: Optional[datetime.datetime] = None
    # The BIM 360 / ACC user ID of the user who last updated the data request.
    updated_by: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithRequestGetResponse:
        """
        Creates a new instance of the appropriate class based on discriminator value
        param parse_node: The parse node to use to read the discriminator value and create the object
        Returns: WithRequestGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithRequestGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        fields: dict[str, Callable[[Any], None]] = {
            "accountId": lambda n : setattr(self, 'account_id', n.get_uuid_value()),
            "callbackUrl": lambda n : setattr(self, 'callback_url', n.get_str_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "createdByEmail": lambda n : setattr(self, 'created_by_email', n.get_str_value()),
            "dateRange": lambda n : setattr(self, 'date_range', n.get_str_value()),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "effectiveFrom": lambda n : setattr(self, 'effective_from', n.get_datetime_value()),
            "effectiveTo": lambda n : setattr(self, 'effective_to', n.get_datetime_value()),
            "endDate": lambda n : setattr(self, 'end_date', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "isActive": lambda n : setattr(self, 'is_active', n.get_bool_value()),
            "lastQueuedAt": lambda n : setattr(self, 'last_queued_at', n.get_datetime_value()),
            "projectId": lambda n : setattr(self, 'project_id', n.get_uuid_value()),
            "projectIdList": lambda n : setattr(self, 'project_id_list', n.get_collection_of_primitive_values(str)),
            "projectStatus": lambda n : setattr(self, 'project_status', n.get_str_value()),
            "reoccuringInterval": lambda n : setattr(self, 'reoccuring_interval', n.get_int_value()),
            "scheduleInterval": lambda n : setattr(self, 'schedule_interval', n.get_str_value()),
            "sendEmail": lambda n : setattr(self, 'send_email', n.get_bool_value()),
            "serviceGroups": lambda n : setattr(self, 'service_groups', n.get_collection_of_primitive_values(str)),
            "startDate": lambda n : setattr(self, 'start_date', n.get_str_value()),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "updatedBy": lambda n : setattr(self, 'updated_by', n.get_str_value()),
        }
        return fields
    
    def serialize(self,writer: SerializationWriter) -> None:
        """
        Serializes information the current object
        param writer: Serialization writer to use to serialize this model
        Returns: None
        """
        if writer is None:
            raise TypeError("writer cannot be null.")
        writer.write_uuid_value("accountId", self.account_id)
        writer.write_str_value("callbackUrl", self.callback_url)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_str_value("createdByEmail", self.created_by_email)
        writer.write_str_value("dateRange", self.date_range)
        writer.write_str_value("description", self.description)
        writer.write_datetime_value("effectiveFrom", self.effective_from)
        writer.write_datetime_value("effectiveTo", self.effective_to)
        writer.write_str_value("endDate", self.end_date)
        writer.write_uuid_value("id", self.id)
        writer.write_bool_value("isActive", self.is_active)
        writer.write_datetime_value("lastQueuedAt", self.last_queued_at)
        writer.write_uuid_value("projectId", self.project_id)
        writer.write_collection_of_primitive_values("projectIdList", self.project_id_list)
        writer.write_str_value("projectStatus", self.project_status)
        writer.write_int_value("reoccuringInterval", self.reoccuring_interval)
        writer.write_str_value("scheduleInterval", self.schedule_interval)
        writer.write_bool_value("sendEmail", self.send_email)
        writer.write_collection_of_primitive_values("serviceGroups", self.service_groups)
        writer.write_str_value("startDate", self.start_date)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedBy", self.updated_by)
    

