# coding: utf-8

"""
    Teambition Open API

    Teambition Open API

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

class BatchGetFileDetailsRequest(BaseModel):
    """
    BatchGetFileDetailsRequest
    """ # noqa: E501
    need_sign: Optional[StrictBool] = Field(default=False, description="是否获取文件下载地址", alias="needSign")
    resource_ids: Optional[Annotated[List[StrictStr], Field(min_length=1, max_length=50)]] = Field(default=None, description="文件资源标识 - 任务评论附件: `task:{taskId}/activity:{activityId}/file:{fileId}` - 任务评论附件的某个版本: `task:{taskId}/activity:{activityId}/file:{fileId}/version:{versionId}` - 任务文件字段: `task:{taskId}/cf:{cfId}/file:{fileId}` - 任务文件字段的某个版本: `task:{taskId}/cf:{cfId}/file:{fileId}/version:{versionId}` - 项目文件: `work:{workId}` - 项目文件的某个版本: `work:{workId}/version:{versionId}` ", alias="resourceIds")
    expire_after_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=1800, description="文件下载地址过期时间（默认30分钟后过期,最长7天）", alias="expireAfterSeconds")
    __properties: ClassVar[List[str]] = ["needSign", "resourceIds", "expireAfterSeconds"]

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

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

        _obj = cls.model_validate({
            "needSign": obj.get("needSign") if obj.get("needSign") is not None else False,
            "resourceIds": obj.get("resourceIds"),
            "expireAfterSeconds": obj.get("expireAfterSeconds") if obj.get("expireAfterSeconds") is not None else 1800
        })
        return _obj


