# 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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class CreateWorkTimeRequest(BaseModel):
    """
    CreateWorkTimeRequest
    """ # noqa: E501
    user_id: Optional[StrictStr] = Field(default=None, description="工时执行人ID", alias="userId")
    submitter_id: Optional[StrictStr] = Field(default=None, description="工时提交人ID", alias="submitterId")
    object_id: Optional[StrictStr] = Field(default=None, description="任务 ID", alias="objectId")
    object_type: Optional[StrictStr] = Field(default=None, description="入参: task", alias="objectType")
    includes_holidays: Optional[StrictInt] = Field(default=None, description="是否包含节假日, 传 1 表示周六日也填工时，否则填0系统会跳过周六日顺延周一开始填工时", alias="includesHolidays")
    is_duration: Optional[StrictInt] = Field(default=None, description="如果开始截止时间跨天了，填1，否则填0", alias="isDuration")
    worktime: Optional[StrictInt] = Field(default=None, description="实际工时数(单位:毫秒, 1h = 3600000ms)")
    start_date: Optional[StrictStr] = Field(default=None, description="开始时间", alias="startDate")
    end_date: Optional[StrictStr] = Field(default=None, description="结束时间", alias="endDate")
    description: Optional[StrictStr] = Field(default=None, description="工作进展")
    ignore_activity: Optional[StrictBool] = Field(default=None, description="是否关闭任务动态", alias="ignoreActivity")
    tag_ids: Optional[List[StrictStr]] = Field(default=None, description="标签ID集合", alias="tagIds")
    __properties: ClassVar[List[str]] = ["userId", "submitterId", "objectId", "objectType", "includesHolidays", "isDuration", "worktime", "startDate", "endDate", "description", "ignoreActivity", "tagIds"]

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

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

        _obj = cls.model_validate({
            "userId": obj.get("userId"),
            "submitterId": obj.get("submitterId"),
            "objectId": obj.get("objectId"),
            "objectType": obj.get("objectType"),
            "includesHolidays": obj.get("includesHolidays"),
            "isDuration": obj.get("isDuration"),
            "worktime": obj.get("worktime"),
            "startDate": obj.get("startDate"),
            "endDate": obj.get("endDate"),
            "description": obj.get("description"),
            "ignoreActivity": obj.get("ignoreActivity"),
            "tagIds": obj.get("tagIds")
        })
        return _obj


