# coding: utf-8

"""
    Neurograph Core

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

    The version of the OpenAPI document: 1.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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from neurograph.v1.models.reports_linked_kpi import ReportsLinkedKPI
from neurograph.v1.models.reports_linked_query import ReportsLinkedQuery
from neurograph.v1.models.reports_recommendation import ReportsRecommendation
from typing import Optional, Set
from typing_extensions import Self

class ReportsReportArtifactCreateRequest(BaseModel):
    """
    ReportsReportArtifactCreateRequest
    """ # noqa: E501
    client_id: Optional[StrictStr] = None
    description: Optional[StrictStr] = None
    embed_url: Optional[StrictStr] = None
    executive_summary: Optional[StrictStr] = None
    key_stats: Optional[List[StrictInt]] = None
    linked_concepts: Optional[List[StrictStr]] = None
    linked_kpis: Optional[List[ReportsLinkedKPI]] = None
    linked_queries: Optional[List[ReportsLinkedQuery]] = None
    linked_themes: Optional[List[StrictStr]] = None
    linked_topics: Optional[List[StrictStr]] = None
    metadata: Optional[List[StrictInt]] = None
    name: StrictStr
    organization_id: Optional[StrictStr] = None
    pdf_url: Optional[StrictStr] = None
    presentation_url: StrictStr
    recommendations: Optional[List[ReportsRecommendation]] = None
    report_type: StrictStr
    thumbnail_url: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["client_id", "description", "embed_url", "executive_summary", "key_stats", "linked_concepts", "linked_kpis", "linked_queries", "linked_themes", "linked_topics", "metadata", "name", "organization_id", "pdf_url", "presentation_url", "recommendations", "report_type", "thumbnail_url"]

    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 ReportsReportArtifactCreateRequest 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 each item in linked_kpis (list)
        _items = []
        if self.linked_kpis:
            for _item_linked_kpis in self.linked_kpis:
                if _item_linked_kpis:
                    _items.append(_item_linked_kpis.to_dict())
            _dict['linked_kpis'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in linked_queries (list)
        _items = []
        if self.linked_queries:
            for _item_linked_queries in self.linked_queries:
                if _item_linked_queries:
                    _items.append(_item_linked_queries.to_dict())
            _dict['linked_queries'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in recommendations (list)
        _items = []
        if self.recommendations:
            for _item_recommendations in self.recommendations:
                if _item_recommendations:
                    _items.append(_item_recommendations.to_dict())
            _dict['recommendations'] = _items
        return _dict

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

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

        _obj = cls.model_validate({
            "client_id": obj.get("client_id"),
            "description": obj.get("description"),
            "embed_url": obj.get("embed_url"),
            "executive_summary": obj.get("executive_summary"),
            "key_stats": obj.get("key_stats"),
            "linked_concepts": obj.get("linked_concepts"),
            "linked_kpis": [ReportsLinkedKPI.from_dict(_item) for _item in obj["linked_kpis"]] if obj.get("linked_kpis") is not None else None,
            "linked_queries": [ReportsLinkedQuery.from_dict(_item) for _item in obj["linked_queries"]] if obj.get("linked_queries") is not None else None,
            "linked_themes": obj.get("linked_themes"),
            "linked_topics": obj.get("linked_topics"),
            "metadata": obj.get("metadata"),
            "name": obj.get("name"),
            "organization_id": obj.get("organization_id"),
            "pdf_url": obj.get("pdf_url"),
            "presentation_url": obj.get("presentation_url"),
            "recommendations": [ReportsRecommendation.from_dict(_item) for _item in obj["recommendations"]] if obj.get("recommendations") is not None else None,
            "report_type": obj.get("report_type"),
            "thumbnail_url": obj.get("thumbnail_url")
        })
        return _obj


