# 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, Field, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self

class ReportingDailyMetric(BaseModel):
    """
    ReportingDailyMetric
    """ # noqa: E501
    aov: Optional[Union[StrictFloat, StrictInt]] = None
    avg_ltv_original: Optional[Union[StrictFloat, StrictInt]] = None
    cohort_customers: Optional[StrictInt] = Field(default=None, description="LTV Metrics (cohort-based)")
    conversion_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="DEPRECATED: Use VisitorConversionRate instead")
    customer_conversion_rate: Optional[Union[StrictFloat, StrictInt]] = None
    customers_with_purchases: Optional[StrictInt] = None
    data_quality_flag: Optional[StrictStr] = None
    iqr_avg_ltv: Optional[Union[StrictFloat, StrictInt]] = None
    ltv_outlier_count: Optional[StrictInt] = None
    median_ltv: Optional[Union[StrictFloat, StrictInt]] = None
    p25_ltv: Optional[Union[StrictFloat, StrictInt]] = None
    p75_ltv: Optional[Union[StrictFloat, StrictInt]] = None
    period_revenue: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Revenue")
    persona_name: Optional[StrictStr] = None
    persona_seed_id: Optional[StrictStr] = None
    rpv: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="RPV Metrics (Revenue / All Visitors)")
    rpv_iqr: Optional[Union[StrictFloat, StrictInt]] = None
    rpv_median: Optional[Union[StrictFloat, StrictInt]] = None
    rpv_outlier_count: Optional[StrictInt] = None
    rpv_p25: Optional[Union[StrictFloat, StrictInt]] = None
    rpv_p75: Optional[Union[StrictFloat, StrictInt]] = None
    rpv_trimmed: Optional[Union[StrictFloat, StrictInt]] = None
    rpv_winsorized: Optional[Union[StrictFloat, StrictInt]] = None
    total_customers: Optional[StrictInt] = Field(default=None, description="Customer Metrics (Shopify-matched)")
    total_visitors: Optional[StrictInt] = Field(default=None, description="Visitor Metrics (hem-based)")
    trimmed_avg_ltv: Optional[Union[StrictFloat, StrictInt]] = None
    visitor_conversion_rate: Optional[Union[StrictFloat, StrictInt]] = None
    visitors_with_purchases: Optional[StrictInt] = None
    winsorized_avg_ltv: Optional[Union[StrictFloat, StrictInt]] = None
    __properties: ClassVar[List[str]] = ["aov", "avg_ltv_original", "cohort_customers", "conversion_rate", "customer_conversion_rate", "customers_with_purchases", "data_quality_flag", "iqr_avg_ltv", "ltv_outlier_count", "median_ltv", "p25_ltv", "p75_ltv", "period_revenue", "persona_name", "persona_seed_id", "rpv", "rpv_iqr", "rpv_median", "rpv_outlier_count", "rpv_p25", "rpv_p75", "rpv_trimmed", "rpv_winsorized", "total_customers", "total_visitors", "trimmed_avg_ltv", "visitor_conversion_rate", "visitors_with_purchases", "winsorized_avg_ltv"]

    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 ReportingDailyMetric 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "aov": obj.get("aov"),
            "avg_ltv_original": obj.get("avg_ltv_original"),
            "cohort_customers": obj.get("cohort_customers"),
            "conversion_rate": obj.get("conversion_rate"),
            "customer_conversion_rate": obj.get("customer_conversion_rate"),
            "customers_with_purchases": obj.get("customers_with_purchases"),
            "data_quality_flag": obj.get("data_quality_flag"),
            "iqr_avg_ltv": obj.get("iqr_avg_ltv"),
            "ltv_outlier_count": obj.get("ltv_outlier_count"),
            "median_ltv": obj.get("median_ltv"),
            "p25_ltv": obj.get("p25_ltv"),
            "p75_ltv": obj.get("p75_ltv"),
            "period_revenue": obj.get("period_revenue"),
            "persona_name": obj.get("persona_name"),
            "persona_seed_id": obj.get("persona_seed_id"),
            "rpv": obj.get("rpv"),
            "rpv_iqr": obj.get("rpv_iqr"),
            "rpv_median": obj.get("rpv_median"),
            "rpv_outlier_count": obj.get("rpv_outlier_count"),
            "rpv_p25": obj.get("rpv_p25"),
            "rpv_p75": obj.get("rpv_p75"),
            "rpv_trimmed": obj.get("rpv_trimmed"),
            "rpv_winsorized": obj.get("rpv_winsorized"),
            "total_customers": obj.get("total_customers"),
            "total_visitors": obj.get("total_visitors"),
            "trimmed_avg_ltv": obj.get("trimmed_avg_ltv"),
            "visitor_conversion_rate": obj.get("visitor_conversion_rate"),
            "visitors_with_purchases": obj.get("visitors_with_purchases"),
            "winsorized_avg_ltv": obj.get("winsorized_avg_ltv")
        })
        return _obj


