# coding: utf-8

"""
    Lumos Connectors

    # The Lumos Connector API ## Intro This API is a self-describing API which allows third-party systems to easily integrate with Lumos. It provides endpoints to retrieve information about each connector, their capabilities.  We call individual libraries that proxy Lumos requests to app-specific requests, and then app-specific responses to Lumos responses, a **connector**.  ## How to use this API 1. You can call the `list_connector_app_ids` to see the list of available connector app IDs, e.g. `pagerduty`. One app ID is required to call most other APIs. 2. Calling `info` explains * what kind of authentication credentials the integration requires * which capabilities the integration supports * what input parameters are required for each capability for the given connector  ## Authenticating with a connector There are two broad categories of authentication - Shared Secret (e.g. API keys) and OAuth-like.  TODO: explain more details - look at `info.authentication_schema` - if it's OAuth - setup needs to call - `get_authorization_url` - `handle_authorization_callback` - steady state needs to call `refresh_access_token` - `validate_credentials` will check that your creds are good, and let you know what the unique tenant ID is  ## Reading customer account data TODO: write more docs - `list_resources` - `list_entitlements` - `find_entitlement_associations`  ## Pagination TODO: write more docs - `response.page.token` may contain an opaque string - pass this string back to the next request `request.page.token` to get the next set of data

    The version of the OpenAPI document: 0.0.0
    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, ConfigDict
from typing import Any, ClassVar, Dict, List, Optional
from connector.generated.models.info import Info
from connector.generated.models.page import Page
from typing import Optional, Set
from typing_extensions import Self

class InfoResponse(BaseModel):
    """
    InfoResponse
    """ # noqa: E501
    response: Info
    raw_data: Optional[Any] = None
    page: Optional[Page] = None
    __properties: ClassVar[List[str]] = ["response", "raw_data", "page"]

    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 InfoResponse 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 response
        if self.response:
            _dict['response'] = self.response.to_dict()
        # override the default output from pydantic by calling `to_dict()` of page
        if self.page:
            _dict['page'] = self.page.to_dict()
        # set to None if raw_data (nullable) is None
        # and model_fields_set contains the field
        if self.raw_data is None and "raw_data" in self.model_fields_set:
            _dict['raw_data'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "response": Info.from_dict(obj["response"]) if obj.get("response") is not None else None,
            "raw_data": obj.get("raw_data"),
            "page": Page.from_dict(obj["page"]) if obj.get("page") is not None else None
        })
        return _obj


