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

@dataclass
class RecipientsGetResponse_externalMembers(Parsable):
    # The company name of the external recipient. This value may change if the external user later updates their company information.
    company_name: Optional[str] = None
    # The date and time when the external recipient first downloaded the transmittal, in ISO 8601 format.
    downloaded_at: Optional[datetime.datetime] = None
    # The email address of the external recipient.
    email: Optional[str] = None
    # The name of the external recipient.
    name: Optional[str] = None
    # The date and time when the external recipient received the transmittal notification, in ISO 8601 format.
    received_at: Optional[datetime.datetime] = None
    # The role name of the external recipient.
    role: Optional[str] = None
    # The date and time when the external recipient first viewed the transmittal, in ISO 8601 format.
    viewed_at: Optional[datetime.datetime] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> RecipientsGetResponse_externalMembers:
        """
        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: RecipientsGetResponse_externalMembers
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return RecipientsGetResponse_externalMembers()
    
    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]] = {
            "companyName": lambda n : setattr(self, 'company_name', n.get_str_value()),
            "downloadedAt": lambda n : setattr(self, 'downloaded_at', n.get_datetime_value()),
            "email": lambda n : setattr(self, 'email', n.get_str_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "receivedAt": lambda n : setattr(self, 'received_at', n.get_datetime_value()),
            "role": lambda n : setattr(self, 'role', n.get_str_value()),
            "viewedAt": lambda n : setattr(self, 'viewed_at', n.get_datetime_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_str_value("companyName", self.company_name)
        writer.write_datetime_value("downloadedAt", self.downloaded_at)
        writer.write_str_value("email", self.email)
        writer.write_str_value("name", self.name)
        writer.write_datetime_value("receivedAt", self.received_at)
        writer.write_str_value("role", self.role)
        writer.write_datetime_value("viewedAt", self.viewed_at)
    

