# 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 .cancel_approval_instance_request_body import CancelApprovalInstanceRequestBody


class CancelApprovalInstanceRequest(BaseRequest):
    def __init__(self) -> None:
        super().__init__()
        self.approval_instance_id: Optional[str] = None
        self.request_body: Optional[CancelApprovalInstanceRequestBody] = None

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


class CancelApprovalInstanceRequestBuilder(object):

    def __init__(self) -> None:
        cancel_approval_instance_request = CancelApprovalInstanceRequest()
        cancel_approval_instance_request.http_method = HttpMethod.POST
        cancel_approval_instance_request.uri = "/open-apis/apaas/v1/approval_instances/:approval_instance_id/cancel"
        cancel_approval_instance_request.token_types = {AccessTokenType.TENANT}
        self._cancel_approval_instance_request: CancelApprovalInstanceRequest = cancel_approval_instance_request

    def approval_instance_id(self, approval_instance_id: str) -> "CancelApprovalInstanceRequestBuilder":
        self._cancel_approval_instance_request.approval_instance_id = approval_instance_id
        self._cancel_approval_instance_request.paths["approval_instance_id"] = str(approval_instance_id)
        return self

    def request_body(self, request_body: CancelApprovalInstanceRequestBody) -> "CancelApprovalInstanceRequestBuilder":
        self._cancel_approval_instance_request.request_body = request_body
        self._cancel_approval_instance_request.body = request_body
        return self

    def build(self) -> CancelApprovalInstanceRequest:
        return self._cancel_approval_instance_request
