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.")
        super().serialize(writer)
        writer.write_datetime_value("expirationDateTime", self.expiration_date_time)
        writer.write_object_value("grantedTo", self.granted_to)
        writer.write_collection_of_object_values("grantedToIdentities", self.granted_to_identities)
        writer.write_collection_of_object_values("grantedToIdentitiesV2", self.granted_to_identities_v2)
        writer.write_object_value("grantedToV2", self.granted_to_v2)
        writer.write_bool_value("hasPassword", self.has_password)
        writer.write_object_value("inheritedFrom", self.inherited_from)
        writer.write_object_value("invitation", self.invitation)
        writer.write_object_value("link", self.link)
        writer.write_collection_of_primitive_values("roles", self.roles)
        writer.write_str_value("shareId", self.share_id)

        Serializes information the current object
        param writer: Serialization writer to use to serialize this model
        Returns: None
        
msgraph/generated/models/permission.py