# coding: utf-8

"""
    Mixpeek API

    This is the Mixpeek API, providing access to various endpoints for data processing and retrieval.

    The version of the OpenAPI document: 1.3.0
    Contact: info@mixpeek.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 datetime
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from mixpeek.models.task_status_enum import TaskStatusEnum
from typing import Optional, Set
from typing_extensions import Self

class ConfirmUploadResponse(BaseModel):
    """
    Response from upload confirmation.
    """ # noqa: E501
    upload_id: StrictStr = Field(description="Upload ID that was confirmed")
    status: TaskStatusEnum = Field(description="Updated upload status (COMPLETED or PROCESSING)")
    etag: Optional[StrictStr] = Field(default=None, description="S3 ETag from uploaded object")
    file_size_bytes: Optional[StrictInt] = Field(default=None, description="Actual file size from S3")
    file_hash: Optional[StrictStr] = Field(default=None, description="File content hash (from ETag)")
    verified_at: Optional[datetime] = Field(default=None, description="When verification completed")
    completed_at: Optional[datetime] = Field(default=None, description="When upload completed")
    object_id: Optional[StrictStr] = Field(default=None, description="Created bucket object ID (if create_object_on_confirm was true)")
    task_id: Optional[StrictStr] = Field(default=None, description="Task ID for async processing (if async=true)")
    message: Optional[StrictStr] = Field(default=None, description="Confirmation message")
    __properties: ClassVar[List[str]] = ["upload_id", "status", "etag", "file_size_bytes", "file_hash", "verified_at", "completed_at", "object_id", "task_id", "message"]

    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 ConfirmUploadResponse 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 ConfirmUploadResponse from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate({
            "upload_id": obj.get("upload_id"),
            "status": obj.get("status"),
            "etag": obj.get("etag"),
            "file_size_bytes": obj.get("file_size_bytes"),
            "file_hash": obj.get("file_hash"),
            "verified_at": obj.get("verified_at"),
            "completed_at": obj.get("completed_at"),
            "object_id": obj.get("object_id"),
            "task_id": obj.get("task_id"),
            "message": obj.get("message")
        })
        return _obj


