# 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_mail_entity import UserMailEntity
from .user_mail_entity import UserMailEntity
from .mail_log_mail_info import MailLogMailInfo
from .mail_flow_rule_info import MailFlowRuleInfo


class MailLog(object):
    _types = {
        "timestamp": int,
        "id": str,
        "initiator": UserMailEntity,
        "operator": UserMailEntity,
        "mail_info": MailLogMailInfo,
        "rule_infos": List[MailFlowRuleInfo],
        "tags": List[str],
    }

    def __init__(self, d=None):
        self.timestamp: Optional[int] = None
        self.id: Optional[str] = None
        self.initiator: Optional[UserMailEntity] = None
        self.operator: Optional[UserMailEntity] = None
        self.mail_info: Optional[MailLogMailInfo] = None
        self.rule_infos: Optional[List[MailFlowRuleInfo]] = None
        self.tags: Optional[List[str]] = None
        init(self, d, self._types)

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


class MailLogBuilder(object):
    def __init__(self) -> None:
        self._mail_log = MailLog()

    def timestamp(self, timestamp: int) -> "MailLogBuilder":
        self._mail_log.timestamp = timestamp
        return self

    def id(self, id: str) -> "MailLogBuilder":
        self._mail_log.id = id
        return self

    def initiator(self, initiator: UserMailEntity) -> "MailLogBuilder":
        self._mail_log.initiator = initiator
        return self

    def operator(self, operator: UserMailEntity) -> "MailLogBuilder":
        self._mail_log.operator = operator
        return self

    def mail_info(self, mail_info: MailLogMailInfo) -> "MailLogBuilder":
        self._mail_log.mail_info = mail_info
        return self

    def rule_infos(self, rule_infos: List[MailFlowRuleInfo]) -> "MailLogBuilder":
        self._mail_log.rule_infos = rule_infos
        return self

    def tags(self, tags: List[str]) -> "MailLogBuilder":
        self._mail_log.tags = tags
        return self

    def build(self) -> "MailLog":
        return self._mail_log
