# Code generated by Lark OpenAPI.

from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.construct import init
from .user_task_wf_instance_type import UserTaskWfInstanceType
from .user import User
from .user_task_summary_type import UserTaskSummaryType


class UserTask(object):
    _types = {
        "task_id": str,
        "task_start_time": str,
        "workflow_instance": UserTaskWfInstanceType,
        "initiator": User,
        "summarys": List[UserTaskSummaryType],
    }

    def __init__(self, d=None):
        self.task_id: Optional[str] = None
        self.task_start_time: Optional[str] = None
        self.workflow_instance: Optional[UserTaskWfInstanceType] = None
        self.initiator: Optional[User] = None
        self.summarys: Optional[List[UserTaskSummaryType]] = None
        init(self, d, self._types)

    @staticmethod
    def builder() -> "UserTaskBuilder":
        return UserTaskBuilder()


class UserTaskBuilder(object):
    def __init__(self) -> None:
        self._user_task = UserTask()

    def task_id(self, task_id: str) -> "UserTaskBuilder":
        self._user_task.task_id = task_id
        return self

    def task_start_time(self, task_start_time: str) -> "UserTaskBuilder":
        self._user_task.task_start_time = task_start_time
        return self

    def workflow_instance(self, workflow_instance: UserTaskWfInstanceType) -> "UserTaskBuilder":
        self._user_task.workflow_instance = workflow_instance
        return self

    def initiator(self, initiator: User) -> "UserTaskBuilder":
        self._user_task.initiator = initiator
        return self

    def summarys(self, summarys: List[UserTaskSummaryType]) -> "UserTaskBuilder":
        self._user_task.summarys = summarys
        return self

    def build(self) -> "UserTask":
        return self._user_task
