# Code generated by Lark OpenAPI.

from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.construct import init


class WidgetInstance(object):
    _types = {
        "instance_code": str,
        "status": str,
        "instance_operate_time": str,
        "is_revert_approval": bool,
        "form_content": str,
        "serial_id": str,
    }

    def __init__(self, d=None):
        self.instance_code: Optional[str] = None
        self.status: Optional[str] = None
        self.instance_operate_time: Optional[str] = None
        self.is_revert_approval: Optional[bool] = None
        self.form_content: Optional[str] = None
        self.serial_id: Optional[str] = None
        init(self, d, self._types)

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


class WidgetInstanceBuilder(object):
    def __init__(self) -> None:
        self._widget_instance = WidgetInstance()

    def instance_code(self, instance_code: str) -> "WidgetInstanceBuilder":
        self._widget_instance.instance_code = instance_code
        return self

    def status(self, status: str) -> "WidgetInstanceBuilder":
        self._widget_instance.status = status
        return self

    def instance_operate_time(self, instance_operate_time: str) -> "WidgetInstanceBuilder":
        self._widget_instance.instance_operate_time = instance_operate_time
        return self

    def is_revert_approval(self, is_revert_approval: bool) -> "WidgetInstanceBuilder":
        self._widget_instance.is_revert_approval = is_revert_approval
        return self

    def form_content(self, form_content: str) -> "WidgetInstanceBuilder":
        self._widget_instance.form_content = form_content
        return self

    def serial_id(self, serial_id: str) -> "WidgetInstanceBuilder":
        self._widget_instance.serial_id = serial_id
        return self

    def build(self) -> "WidgetInstance":
        return self._widget_instance
