# coding: utf-8

"""
    Whisper API v1

    <h2>The Foundational Intelligence Layer for the Internet</h2> <p>The Whisper API provides comprehensive, real-time intelligence on any internet asset. By connecting billions of data points across live internet routing, historical registration records, and deep resolution data, our API moves beyond simple enrichment to deliver predictive, context-rich insights.</p> <p>This document is the single source of truth for our v1 API. It is designed for security experts, developers, and automated systems to understand and leverage the full power of our platform.</p>  <h3>🚀 Quick Start</h3> <p><b>1. Get your API key:</b> <a href=\"https://dash.whisper.security\">Sign up at dash.whisper.security</a></p> <p><b>2. Make your first request:</b></p> <pre><code>curl -H \"Authorization: Bearer YOUR_API_KEY\" https://api.whisper.security/v1/indicators/ip/8.8.8.8</code></pre> <p><b>3. Explore the API:</b> Use the \"Try it out\" button in each endpoint below to test interactively.</p>  <h3>🎯 Key Features</h3> <ul>     <li><b>Unified & Simple:</b> Small set of powerful, resource-oriented endpoints</li>     <li><b>Performant by Design:</b> Asynchronous-first with strategic caching (&lt;500ms typical response)</li>     <li><b>Workflow-Oriented:</b> Built for real-world security operations, not just data dumps</li>     <li><b>Comprehensive:</b> IP, Domain, DNS, WHOIS, Routing, Geolocation, Screenshots, Monitoring</li> </ul>  <h3>⚡ Performance Targets</h3> <table>     <tr><th>Endpoint Type</th><th>Response Time</th><th>Use Case</th></tr>     <tr><td>Geolocation</td><td>&lt;150ms</td><td>Real-time fraud detection</td></tr>     <tr><td>Single Indicator</td><td>&lt;500ms</td><td>Incident response enrichment</td></tr>     <tr><td>With Routing Data</td><td>&lt;2s (cached: 200ms)</td><td>Deep network analysis</td></tr>     <tr><td>Bulk Operations</td><td>5-30s</td><td>Batch log enrichment</td></tr>     <tr><td>Search/Discovery</td><td>10-60s</td><td>Threat hunting</td></tr> </table>  <h3>🔐 Authentication</h3> <p>All endpoints require Bearer token authentication. Click the <b>\"Authorize\"</b> button above and enter your API key.</p> <pre><code>Authorization: Bearer wsk_live_1234567890abcdef</code></pre>  <h3>📊 Rate Limits</h3> <table>     <tr><th>Category</th><th>Limit</th></tr>     <tr><td>Standard Enrichment</td><td>100 req/min</td></tr>     <tr><td>Bulk Operations</td><td>10 req/min</td></tr>     <tr><td>Search/Discovery</td><td>5 req/min</td></tr>     <tr><td>Screenshots</td><td>10 req/min</td></tr> </table> <p><i>Rate limits return HTTP 429. Retry after the time specified in the <code>Retry-After</code> header.</i></p>  <h3>📚 Resources</h3> <ul>     <li><a href=\"https://docs.whisper.security\">Full Documentation</a></li>     <li><a href=\"https://docs.whisper.security/quickstart\">Quick Start Guide</a></li>     <li><a href=\"https://docs.whisper.security/examples\">Code Examples</a></li>     <li><a href=\"https://whisper.security/support\">API Support</a></li> </ul> 

    The version of the OpenAPI document: 1.0.0
    Contact: api-support@whisper.security
    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, Field
from typing import Any, ClassVar, Dict, List, Optional
from whisper_api_sdk.models.dns_info import DnsInfo
from whisper_api_sdk.models.metadata_info import MetadataInfo
from whisper_api_sdk.models.query_info import QueryInfo
from whisper_api_sdk.models.relationship_info import RelationshipInfo
from whisper_api_sdk.models.reputation_info import ReputationInfo
from whisper_api_sdk.models.summary_info import SummaryInfo
from typing import Optional, Set
from typing_extensions import Self

class IndicatorResponse(BaseModel):
    """
    Comprehensive intelligence response for an IP address or domain indicator
    """ # noqa: E501
    query: Optional[QueryInfo] = None
    summary: Optional[SummaryInfo] = None
    geolocation: Optional[Dict[str, Any]] = None
    network: Optional[Dict[str, Any]] = None
    isp: Optional[Dict[str, Any]] = None
    registration: Optional[Dict[str, Any]] = None
    dns: Optional[DnsInfo] = None
    relationships: Optional[RelationshipInfo] = None
    reputation: Optional[ReputationInfo] = None
    security: Optional[Dict[str, Any]] = None
    ip_intelligence: Optional[Dict[str, Dict[str, Any]]] = Field(default=None, description="When domain is queried with include=ip_intelligence, contains full intelligence for each resolved IP")
    metadata: Optional[MetadataInfo] = None
    __properties: ClassVar[List[str]] = ["query", "summary", "geolocation", "network", "isp", "registration", "dns", "relationships", "reputation", "security", "ip_intelligence", "metadata"]

    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 IndicatorResponse 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 query
        if self.query:
            _dict['query'] = self.query.to_dict()
        # override the default output from pydantic by calling `to_dict()` of summary
        if self.summary:
            _dict['summary'] = self.summary.to_dict()
        # override the default output from pydantic by calling `to_dict()` of dns
        if self.dns:
            _dict['dns'] = self.dns.to_dict()
        # override the default output from pydantic by calling `to_dict()` of relationships
        if self.relationships:
            _dict['relationships'] = self.relationships.to_dict()
        # override the default output from pydantic by calling `to_dict()` of reputation
        if self.reputation:
            _dict['reputation'] = self.reputation.to_dict()
        # override the default output from pydantic by calling `to_dict()` of metadata
        if self.metadata:
            _dict['metadata'] = self.metadata.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "query": QueryInfo.from_dict(obj["query"]) if obj.get("query") is not None else None,
            "summary": SummaryInfo.from_dict(obj["summary"]) if obj.get("summary") is not None else None,
            "geolocation": obj.get("geolocation"),
            "network": obj.get("network"),
            "isp": obj.get("isp"),
            "registration": obj.get("registration"),
            "dns": DnsInfo.from_dict(obj["dns"]) if obj.get("dns") is not None else None,
            "relationships": RelationshipInfo.from_dict(obj["relationships"]) if obj.get("relationships") is not None else None,
            "reputation": ReputationInfo.from_dict(obj["reputation"]) if obj.get("reputation") is not None else None,
            "security": obj.get("security"),
            "ip_intelligence": obj.get("ip_intelligence"),
            "metadata": MetadataInfo.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None
        })
        return _obj


