# coding: utf-8

"""
    File Service v2

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

    The version of the OpenAPI document: 0.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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class CompletedPartTypeDef(BaseModel):
    """
    CompletedPartTypeDef
    """ # noqa: E501
    e_tag: Optional[StrictStr] = Field(default=None, alias="ETag")
    checksum_crc32: Optional[StrictStr] = Field(default=None, alias="ChecksumCRC32")
    checksum_crc32_c: Optional[StrictStr] = Field(default=None, alias="ChecksumCRC32C")
    checksum_crc64_nvme: Optional[StrictStr] = Field(default=None, alias="ChecksumCRC64NVME")
    checksum_sha1: Optional[StrictStr] = Field(default=None, alias="ChecksumSHA1")
    checksum_sha256: Optional[StrictStr] = Field(default=None, alias="ChecksumSHA256")
    part_number: Optional[StrictInt] = Field(default=None, alias="PartNumber")
    __properties: ClassVar[List[str]] = ["ETag", "ChecksumCRC32", "ChecksumCRC32C", "ChecksumCRC64NVME", "ChecksumSHA1", "ChecksumSHA256", "PartNumber"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """
        Return the string representation of the model using field aliases.

        This method serializes the model to a JSON-formatted string, respecting any defined aliases
        for fields instead of their original attribute names.
        """

        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """
        Return the JSON string representation of the model using field aliases.

        This method serializes the model into a JSON-formatted string, using aliases for field names
        where defined instead of their raw attribute names.
        """

        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """
        Create an instance of the model from a JSON string.

        This method deserializes the given JSON string into a model instance. It expects the
        string to match the model's schema, using field aliases where applicable.

        :param json_str: JSON string representing the model.
        :type json_str: str
        """

        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """
        Return the dictionary representation of the model using field aliases.

        This method differs from calling `self.model_dump(by_alias=True)` in the following way:

        - Fields with a value of `None` are included in the output only if they are nullable and
          were explicitly set during model initialization. All other `None` fields are omitted.
        """

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

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

        _obj = cls.model_validate({
            "ETag": obj.get("ETag"),
            "ChecksumCRC32": obj.get("ChecksumCRC32"),
            "ChecksumCRC32C": obj.get("ChecksumCRC32C"),
            "ChecksumCRC64NVME": obj.get("ChecksumCRC64NVME"),
            "ChecksumSHA1": obj.get("ChecksumSHA1"),
            "ChecksumSHA256": obj.get("ChecksumSHA256"),
            "PartNumber": obj.get("PartNumber")
        })
        return _obj
