# coding: utf-8

"""
    Instana REST API documentation

    Documentation for INSTANA REST API

    The version of the OpenAPI document: 1.309.1268
    Contact: support@instana.com
    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 ConfigDict
from typing import Any, ClassVar, Dict, List, Optional
from instana_client.models.synthetic_resource_update_list_string_list_string import SyntheticResourceUpdateListStringListString
from instana_client.models.synthetic_resource_update_map_string_string_list_string import SyntheticResourceUpdateMapStringStringListString
from instana_client.models.synthetic_test_update import SyntheticTestUpdate
from instana_client.models.synthetic_type_configuration_update import SyntheticTypeConfigurationUpdate
from typing import Optional, Set
from typing_extensions import Self

class SyntheticTestDeepUpdate(SyntheticTestUpdate):
    """
    SyntheticTestDeepUpdate
    """ # noqa: E501
    configuration: Optional[SyntheticTypeConfigurationUpdate] = None
    __properties: ClassVar[List[str]] = ["active", "applications", "customProperties", "ids", "lastModifiedAt", "locations", "mobileApps", "modifiedBy", "shallowUpdate", "syntheticUpdateType", "testFrequency", "websites", "configuration"]

    model_config = ConfigDict(
        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 SyntheticTestDeepUpdate 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 applications
        if self.applications:
            _dict['applications'] = self.applications.to_dict()
        # override the default output from pydantic by calling `to_dict()` of custom_properties
        if self.custom_properties:
            _dict['customProperties'] = self.custom_properties.to_dict()
        # override the default output from pydantic by calling `to_dict()` of locations
        if self.locations:
            _dict['locations'] = self.locations.to_dict()
        # override the default output from pydantic by calling `to_dict()` of mobile_apps
        if self.mobile_apps:
            _dict['mobileApps'] = self.mobile_apps.to_dict()
        # override the default output from pydantic by calling `to_dict()` of websites
        if self.websites:
            _dict['websites'] = self.websites.to_dict()
        # override the default output from pydantic by calling `to_dict()` of configuration
        if self.configuration:
            _dict['configuration'] = self.configuration.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "active": obj.get("active"),
            "applications": SyntheticResourceUpdateListStringListString.from_dict(obj["applications"]) if obj.get("applications") is not None else None,
            "customProperties": SyntheticResourceUpdateMapStringStringListString.from_dict(obj["customProperties"]) if obj.get("customProperties") is not None else None,
            "ids": obj.get("ids"),
            "lastModifiedAt": obj.get("lastModifiedAt"),
            "locations": SyntheticResourceUpdateListStringListString.from_dict(obj["locations"]) if obj.get("locations") is not None else None,
            "mobileApps": SyntheticResourceUpdateListStringListString.from_dict(obj["mobileApps"]) if obj.get("mobileApps") is not None else None,
            "modifiedBy": obj.get("modifiedBy"),
            "shallowUpdate": obj.get("shallowUpdate"),
            "syntheticUpdateType": obj.get("syntheticUpdateType"),
            "testFrequency": obj.get("testFrequency"),
            "websites": SyntheticResourceUpdateListStringListString.from_dict(obj["websites"]) if obj.get("websites") is not None else None,
            "configuration": SyntheticTypeConfigurationUpdate.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None
        })
        return _obj


