# Code generated by Lark OpenAPI.

from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.model import BaseRequest
from lark_oapi.core.enum import HttpMethod, AccessTokenType
from .rollback_user_task_request_body import RollbackUserTaskRequestBody


class RollbackUserTaskRequest(BaseRequest):
    def __init__(self) -> None:
        super().__init__()
        self.task_id: Optional[str] = None
        self.request_body: Optional[RollbackUserTaskRequestBody] = None

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


class RollbackUserTaskRequestBuilder(object):

    def __init__(self) -> None:
        rollback_user_task_request = RollbackUserTaskRequest()
        rollback_user_task_request.http_method = HttpMethod.POST
        rollback_user_task_request.uri = "/open-apis/apaas/v1/user_tasks/:task_id/rollback"
        rollback_user_task_request.token_types = {AccessTokenType.TENANT}
        self._rollback_user_task_request: RollbackUserTaskRequest = rollback_user_task_request

    def task_id(self, task_id: str) -> "RollbackUserTaskRequestBuilder":
        self._rollback_user_task_request.task_id = task_id
        self._rollback_user_task_request.paths["task_id"] = str(task_id)
        return self

    def request_body(self, request_body: RollbackUserTaskRequestBody) -> "RollbackUserTaskRequestBuilder":
        self._rollback_user_task_request.request_body = request_body
        self._rollback_user_task_request.body = request_body
        return self

    def build(self) -> RollbackUserTaskRequest:
        return self._rollback_user_task_request
