# coding: utf-8

"""
Cashfree Payment Gateway APIs

Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites.

The version of the OpenAPI document: 2023-08-01
Contact: developers@cashfree.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 datetime import date, datetime


from cashfree_pg.models.customer_details_in_disputes_entity import CustomerDetailsInDisputesEntity
from cashfree_pg.models.evidence import Evidence
from cashfree_pg.models.evidences_to_contest_dispute import EvidencesToContestDispute
from cashfree_pg.models.order_details_in_disputes_entity import OrderDetailsInDisputesEntity
from pydantic import validate_arguments, ValidationError, Field, StrictStr, StrictBytes, StrictInt, StrictFloat, StrictBool, field_validator, BaseModel
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

class DisputesEntityMerchantAccepted(BaseModel):
    """
    DisputesEntityMerchantAccepted
    """
    dispute_id: Optional[StrictInt] = None
    dispute_type: Optional[StrictStr] = None
    reason_code: Optional[StrictStr] = None
    reason_description: Optional[StrictStr] = None
    dispute_amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Dispute amount may differ from transaction amount for partial cases.")
    created_at: Optional[StrictStr] = Field(default=None, description="This is the time when the dispute was created.")
    respond_by: Optional[StrictStr] = Field(default=None, description="This is the time by which evidence should be submitted to contest the dispute.")
    updated_at: Optional[StrictStr] = Field(default=None, description="This is the time when the dispute case was updated.")
    resolved_at: Optional[StrictStr] = Field(default=None, description="This is the time when the dispute case was closed.")
    dispute_status: Optional[StrictStr] = None
    cf_dispute_remarks: Optional[StrictStr] = None
    preferred_evidence: Optional[List[EvidencesToContestDispute]] = None
    dispute_evidence: Optional[List[Evidence]] = None
    order_details: Optional[OrderDetailsInDisputesEntity] = None
    customer_details: Optional[CustomerDetailsInDisputesEntity] = None
    __properties = ["dispute_id", "dispute_type", "reason_code", "reason_description", "dispute_amount", "created_at", "respond_by", "updated_at", "resolved_at", "dispute_status", "cf_dispute_remarks", "preferred_evidence", "dispute_evidence", "order_details", "customer_details"]

    @field_validator('dispute_type')
    def dispute_type_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in ('DISPUTE', 'CHARGEBACK', 'RETRIEVAL', 'PRE_ARBITRATION', 'ARBITRATION'):
            raise ValueError("must be one of enum values ('DISPUTE', 'CHARGEBACK', 'RETRIEVAL', 'PRE_ARBITRATION', 'ARBITRATION')")
        return value

    @field_validator('dispute_status')
    def dispute_status_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in ('DISPUTE_CREATED', 'DISPUTE_DOCS_RECEIVED', 'DISPUTE_UNDER_REVIEW', 'DISPUTE_MERCHANT_WON', 'DISPUTE_MERCHANT_LOST', 'DISPUTE_MERCHANT_ACCEPTED', 'DISPUTE_INSUFFICIENT_EVIDENCE', 'CHARGEBACK_CREATED', 'CHARGEBACK_DOCS_RECEIVED', 'CHARGEBACK_UNDER_REVIEW', 'CHARGEBACK_MERCHANT_WON', 'CHARGEBACK_MERCHANT_LOST', 'CHARGEBACK_MERCHANT_ACCEPTED', 'CHARGEBACK_INSUFFICIENT_EVIDENCE', 'RETRIEVAL_CREATED', 'RETRIEVAL_DOCS_RECEIVED', 'RETRIEVAL_UNDER_REVIEW', 'RETRIEVAL_MERCHANT_WON', 'RETRIEVAL_MERCHANT_LOST', 'RETRIEVAL_MERCHANT_ACCEPTED', 'RETRIEVAL_INSUFFICIENT_EVIDENCE', 'PRE_ARBITRATION_CREATED', 'PRE_ARBITRATION_DOCS_RECEIVED', 'PRE_ARBITRATION_UNDER_REVIEW', 'PRE_ARBITRATION_MERCHANT_WON', 'PRE_ARBITRATION_MERCHANT_LOST', 'PRE_ARBITRATION_MERCHANT_ACCEPTED', 'PRE_ARBITRATION_INSUFFICIENT_EVIDENCE', 'ARBITRATION_CREATED', 'ARBITRATION_DOCS_RECEIVED', 'ARBITRATION_UNDER_REVIEW', 'ARBITRATION_MERCHANT_WON', 'ARBITRATION_MERCHANT_LOST', 'ARBITRATION_MERCHANT_ACCEPTED', 'ARBITRATION_INSUFFICIENT_EVIDENCE'):
            raise ValueError("must be one of enum values ('DISPUTE_CREATED', 'DISPUTE_DOCS_RECEIVED', 'DISPUTE_UNDER_REVIEW', 'DISPUTE_MERCHANT_WON', 'DISPUTE_MERCHANT_LOST', 'DISPUTE_MERCHANT_ACCEPTED', 'DISPUTE_INSUFFICIENT_EVIDENCE', 'CHARGEBACK_CREATED', 'CHARGEBACK_DOCS_RECEIVED', 'CHARGEBACK_UNDER_REVIEW', 'CHARGEBACK_MERCHANT_WON', 'CHARGEBACK_MERCHANT_LOST', 'CHARGEBACK_MERCHANT_ACCEPTED', 'CHARGEBACK_INSUFFICIENT_EVIDENCE', 'RETRIEVAL_CREATED', 'RETRIEVAL_DOCS_RECEIVED', 'RETRIEVAL_UNDER_REVIEW', 'RETRIEVAL_MERCHANT_WON', 'RETRIEVAL_MERCHANT_LOST', 'RETRIEVAL_MERCHANT_ACCEPTED', 'RETRIEVAL_INSUFFICIENT_EVIDENCE', 'PRE_ARBITRATION_CREATED', 'PRE_ARBITRATION_DOCS_RECEIVED', 'PRE_ARBITRATION_UNDER_REVIEW', 'PRE_ARBITRATION_MERCHANT_WON', 'PRE_ARBITRATION_MERCHANT_LOST', 'PRE_ARBITRATION_MERCHANT_ACCEPTED', 'PRE_ARBITRATION_INSUFFICIENT_EVIDENCE', 'ARBITRATION_CREATED', 'ARBITRATION_DOCS_RECEIVED', 'ARBITRATION_UNDER_REVIEW', 'ARBITRATION_MERCHANT_WON', 'ARBITRATION_MERCHANT_LOST', 'ARBITRATION_MERCHANT_ACCEPTED', 'ARBITRATION_INSUFFICIENT_EVIDENCE')")
        return value

    # Updated to Pydantic v2
    """Pydantic configuration"""
    model_config = {
        "populate_by_name": True,
        "validate_assignment": True
    }

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> DisputesEntityMerchantAccepted:
        """Create an instance of DisputesEntityMerchantAccepted from a JSON string"""
        return cls.from_dict(json.loads(json_str))
    
    @classmethod
    def from_json_for_one_of(cls, json_str: str) -> DisputesEntityMerchantAccepted:
        """Create an instance of DisputesEntityMerchantAccepted from a JSON string"""
        temp_dict = json.loads(json_str)
        if "dispute_id, dispute_type, reason_code, reason_description, dispute_amount, created_at, respond_by, updated_at, resolved_at, dispute_status, cf_dispute_remarks, preferred_evidence, dispute_evidence, order_details, customer_details" in temp_dict.keys():
            return cls.from_dict(json.loads(json_str))
        return None

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of each item in preferred_evidence (list)
        _items = []
        if self.preferred_evidence:
            for _item in self.preferred_evidence:
                if _item:
                    _items.append(_item.to_dict())
            _dict['preferred_evidence'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in dispute_evidence (list)
        _items = []
        if self.dispute_evidence:
            for _item in self.dispute_evidence:
                if _item:
                    _items.append(_item.to_dict())
            _dict['dispute_evidence'] = _items
        # override the default output from pydantic by calling `to_dict()` of order_details
        if self.order_details:
            _dict['order_details'] = self.order_details.to_dict()
        # override the default output from pydantic by calling `to_dict()` of customer_details
        if self.customer_details:
            _dict['customer_details'] = self.customer_details.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> DisputesEntityMerchantAccepted:
        """Create an instance of DisputesEntityMerchantAccepted from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return DisputesEntityMerchantAccepted.parse_obj(obj)

        _obj = DisputesEntityMerchantAccepted.parse_obj({
            "dispute_id": obj.get("dispute_id"),
            "dispute_type": obj.get("dispute_type"),
            "reason_code": obj.get("reason_code"),
            "reason_description": obj.get("reason_description"),
            "dispute_amount": obj.get("dispute_amount"),
            "created_at": obj.get("created_at"),
            "respond_by": obj.get("respond_by"),
            "updated_at": obj.get("updated_at"),
            "resolved_at": obj.get("resolved_at"),
            "dispute_status": obj.get("dispute_status"),
            "cf_dispute_remarks": obj.get("cf_dispute_remarks"),
            "preferred_evidence": [EvidencesToContestDispute.from_dict(_item) for _item in obj.get("preferred_evidence")] if obj.get("preferred_evidence") is not None else None,
            "dispute_evidence": [Evidence.from_dict(_item) for _item in obj.get("dispute_evidence")] if obj.get("dispute_evidence") is not None else None,
            "order_details": OrderDetailsInDisputesEntity.from_dict(obj.get("order_details")) if obj.get("order_details") is not None else None,
            "customer_details": CustomerDetailsInDisputesEntity.from_dict(obj.get("customer_details")) if obj.get("customer_details") is not None else None
        })
        return _obj


# Pydantic v2: resolve forward references & Annotated types
DisputesEntityMerchantAccepted.model_rebuild()

