# coding: utf-8

"""
    Moodle Webservice API

    Auto-generated OpenAPI spec for Moodle's Webservice API.

    The version of the OpenAPI document: 4.5 (Build: 20241007)
    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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self

class CoreCompetencyReadUserEvidenceResponseFilesInner(BaseModel):
    """
    CoreCompetencyReadUserEvidenceResponseFilesInner
    """ # noqa: E501
    author: StrictStr = Field(description="author")
    component: StrictStr = Field(description="component")
    contextid: StrictInt = Field(description="contextid")
    filearea: StrictStr = Field(description="filearea")
    filename: StrictStr = Field(description="filename")
    filenameshort: StrictStr = Field(description="filenameshort")
    filepath: StrictStr = Field(description="filepath")
    filesize: StrictInt = Field(description="filesize")
    filesizeformatted: StrictStr = Field(description="filesizeformatted")
    icon: StrictStr = Field(description="icon")
    isdir: StrictBool = Field(description="isdir")
    isimage: StrictBool = Field(description="isimage")
    itemid: StrictInt = Field(description="itemid")
    license: StrictStr = Field(description="license")
    timecreated: StrictInt = Field(description="timecreated")
    timecreatedformatted: StrictStr = Field(description="timecreatedformatted")
    timemodified: StrictInt = Field(description="timemodified")
    timemodifiedformatted: StrictStr = Field(description="timemodifiedformatted")
    url: StrictStr = Field(description="url")
    __properties: ClassVar[List[str]] = ["author", "component", "contextid", "filearea", "filename", "filenameshort", "filepath", "filesize", "filesizeformatted", "icon", "isdir", "isimage", "itemid", "license", "timecreated", "timecreatedformatted", "timemodified", "timemodifiedformatted", "url"]

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

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

        _obj = cls.model_validate({
            "author": obj.get("author") if obj.get("author") is not None else '',
            "component": obj.get("component") if obj.get("component") is not None else '',
            "contextid": obj.get("contextid") if obj.get("contextid") is not None else 0,
            "filearea": obj.get("filearea") if obj.get("filearea") is not None else '',
            "filename": obj.get("filename") if obj.get("filename") is not None else '',
            "filenameshort": obj.get("filenameshort") if obj.get("filenameshort") is not None else '',
            "filepath": obj.get("filepath") if obj.get("filepath") is not None else '',
            "filesize": obj.get("filesize") if obj.get("filesize") is not None else 0,
            "filesizeformatted": obj.get("filesizeformatted") if obj.get("filesizeformatted") is not None else '',
            "icon": obj.get("icon") if obj.get("icon") is not None else '',
            "isdir": obj.get("isdir") if obj.get("isdir") is not None else False,
            "isimage": obj.get("isimage") if obj.get("isimage") is not None else False,
            "itemid": obj.get("itemid") if obj.get("itemid") is not None else 0,
            "license": obj.get("license") if obj.get("license") is not None else '',
            "timecreated": obj.get("timecreated") if obj.get("timecreated") is not None else 0,
            "timecreatedformatted": obj.get("timecreatedformatted") if obj.get("timecreatedformatted") is not None else '',
            "timemodified": obj.get("timemodified") if obj.get("timemodified") is not None else 0,
            "timemodifiedformatted": obj.get("timemodifiedformatted") if obj.get("timemodifiedformatted") is not None else '',
            "url": obj.get("url") if obj.get("url") is not None else ''
        })
        return _obj


