# coding: utf-8

"""
    seqq

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 0.0.18
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from seqq.models.v1alpha_integration_google_drive import V1alphaIntegrationGoogleDrive
from seqq.models.v1alpha_integration_ncbi import V1alphaIntegrationNCBI
from typing import Optional, Set
from typing_extensions import Self

class TheIntegrationToUpdate(BaseModel):
    """
    TheIntegrationToUpdate
    """ # noqa: E501
    collection: StrictStr = Field(description="The name of the Collection that the Integration imports Sequences to. Format is `collections/{collection_id}`.")
    sequence_id_prefix: Optional[StrictStr] = Field(default=None, description="A prefix that is prepended to all Sequence IDs added to the Collection.  For example, if \"proteins/flourescent\" is imported to a Collection \"my-collection\", and a Sequence with an ID of \"GFP\" is imported, the Sequence name will be \"collections/my-collection/sequences/proteins/flourescent/GFP\".", alias="sequenceIdPrefix")
    etag: Optional[StrictStr] = Field(default=None, description="An opaque, server-assigned value that is the hash of all fields in the Integration. Each change to an integration changes the Etag value.")
    ncbi: Optional[V1alphaIntegrationNCBI] = None
    google_drive: Optional[V1alphaIntegrationGoogleDrive] = Field(default=None, alias="googleDrive")
    __properties: ClassVar[List[str]] = ["collection", "sequenceIdPrefix", "etag", "ncbi", "googleDrive"]

    model_config = {
        "populate_by_name": True,
        "validate_assignment": True,
        "protected_namespaces": (),
    }


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of TheIntegrationToUpdate from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of ncbi
        if self.ncbi:
            _dict['ncbi'] = self.ncbi.to_dict()
        # override the default output from pydantic by calling `to_dict()` of google_drive
        if self.google_drive:
            _dict['googleDrive'] = self.google_drive.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of TheIntegrationToUpdate from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "collection": obj.get("collection"),
            "sequenceIdPrefix": obj.get("sequenceIdPrefix"),
            "etag": obj.get("etag"),
            "ncbi": V1alphaIntegrationNCBI.from_dict(obj["ncbi"]) if obj.get("ncbi") is not None else None,
            "googleDrive": V1alphaIntegrationGoogleDrive.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None
        })
        return _obj


