# coding: utf-8

"""
    FastAPI

    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 typing import Any, Optional
from pydantic import BaseModel, Field

class BIAImageOutput(BaseModel):
    """
    This class represents the abstract concept of an image. Images are generated by acquisition by instruments.  Examples:  * A single plane bright-field image of a bacterium. * A confocal fluorescence image of cells, with two channels. * A volume EM stack of a cell.  Images are distinct from their representation as files, since the same image can be represented in different file formats and in some cases different file structures.
    """
    uuid: Optional[Any] = Field(...)
    version: Optional[Any] = Field(...)
    model: Optional[Any] = None
    study_uuid: Optional[Any] = Field(...)
    original_relpath: Optional[Any] = Field(...)
    name: Optional[Any] = None
    dimensions: Optional[Any] = None
    representations: Optional[Any] = None
    attributes: Optional[Any] = None
    annotations: Optional[Any] = None
    alias: Optional[Any] = None
    additional_properties: Dict[str, Any] = {}
    __properties = ["uuid", "version", "model", "study_uuid", "original_relpath", "name", "dimensions", "representations", "attributes", "annotations", "alias"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_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) -> BIAImageOutput:
        """Create an instance of BIAImageOutput from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                            "additional_properties"
                          },
                          exclude_none=True)
        # puts key-value pairs in additional_properties in the top level
        if self.additional_properties is not None:
            for _key, _value in self.additional_properties.items():
                _dict[_key] = _value

        # set to None if uuid (nullable) is None
        # and __fields_set__ contains the field
        if self.uuid is None and "uuid" in self.__fields_set__:
            _dict['uuid'] = None

        # set to None if version (nullable) is None
        # and __fields_set__ contains the field
        if self.version is None and "version" in self.__fields_set__:
            _dict['version'] = None

        # set to None if model (nullable) is None
        # and __fields_set__ contains the field
        if self.model is None and "model" in self.__fields_set__:
            _dict['model'] = None

        # set to None if study_uuid (nullable) is None
        # and __fields_set__ contains the field
        if self.study_uuid is None and "study_uuid" in self.__fields_set__:
            _dict['study_uuid'] = None

        # set to None if original_relpath (nullable) is None
        # and __fields_set__ contains the field
        if self.original_relpath is None and "original_relpath" in self.__fields_set__:
            _dict['original_relpath'] = None

        # set to None if name (nullable) is None
        # and __fields_set__ contains the field
        if self.name is None and "name" in self.__fields_set__:
            _dict['name'] = None

        # set to None if dimensions (nullable) is None
        # and __fields_set__ contains the field
        if self.dimensions is None and "dimensions" in self.__fields_set__:
            _dict['dimensions'] = None

        # set to None if representations (nullable) is None
        # and __fields_set__ contains the field
        if self.representations is None and "representations" in self.__fields_set__:
            _dict['representations'] = None

        # set to None if attributes (nullable) is None
        # and __fields_set__ contains the field
        if self.attributes is None and "attributes" in self.__fields_set__:
            _dict['attributes'] = None

        # set to None if annotations (nullable) is None
        # and __fields_set__ contains the field
        if self.annotations is None and "annotations" in self.__fields_set__:
            _dict['annotations'] = None

        # set to None if alias (nullable) is None
        # and __fields_set__ contains the field
        if self.alias is None and "alias" in self.__fields_set__:
            _dict['alias'] = None

        return _dict

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

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

        _obj = BIAImageOutput.parse_obj({
            "uuid": obj.get("uuid"),
            "version": obj.get("version"),
            "model": obj.get("model"),
            "study_uuid": obj.get("study_uuid"),
            "original_relpath": obj.get("original_relpath"),
            "name": obj.get("name"),
            "dimensions": obj.get("dimensions"),
            "representations": obj.get("representations"),
            "attributes": obj.get("attributes"),
            "annotations": obj.get("annotations"),
            "alias": obj.get("alias")
        })
        # store additional fields in additional_properties
        for _key in obj.keys():
            if _key not in cls.__properties:
                _obj.additional_properties[_key] = obj.get(_key)

        return _obj


