# Code generated by lark_sdk_gen. DO NOT EDIT.

from pylark.lark_request import RawRequestReq, _new_method_option
from pylark import lark_type, lark_type_sheet, lark_type_approval
import attr
import typing
import io


@attr.s
class CreateMailGroupReq(object):
    email: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "email"}
    )  # 邮件组地址, 示例值："test_mail_group@xxx.xx"
    name: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "name"}
    )  # 邮件组名称, 示例值："test mail group"
    description: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "description"}
    )  # 邮件组描述, 示例值："mail group for testing"
    who_can_send_mail: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "who_can_send_mail"}
    )  # 谁可发送邮件到此邮件组, 示例值："ALL_INTERNAL_USERS", 可选值有: `ANYONE`：任何人, `ALL_INTERNAL_USERS`：仅组织内部成员, `ALL_GROUP_MEMBERS`：仅邮件组成员, `CUSTOM_MEMBERS`：自定义成员


@attr.s
class CreateMailGroupResp(object):
    mailgroup_id: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "mailgroup_id"}
    )  # 邮件组ID
    email: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "email"}
    )  # 邮件组地址
    name: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "name"}
    )  # 邮件组名称
    description: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "description"}
    )  # 邮件组描述
    direct_members_count: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "direct_members_count"}
    )  # 邮件组成员数量
    include_external_member: bool = attr.ib(
        factory=lambda: bool(),
        metadata={"req_type": "json", "key": "include_external_member"},
    )  # 是否包含外部成员
    include_all_company_member: bool = attr.ib(
        factory=lambda: bool(),
        metadata={"req_type": "json", "key": "include_all_company_member"},
    )  # 是否是全员邮件组
    who_can_send_mail: str = attr.ib(
        default="", metadata={"req_type": "json", "key": "who_can_send_mail"}
    )  # 谁可发送邮件到此邮件组, 可选值有: `ANYONE`：任何人, `ALL_INTERNAL_USERS`：仅组织内部成员, `ALL_GROUP_MEMBERS`：仅邮件组成员, `CUSTOM_MEMBERS`：自定义成员


def _gen_create_mailgroup_req(request, options) -> RawRequestReq:
    return RawRequestReq(
        dataclass=CreateMailGroupResp,
        scope="Mail",
        api="CreateMailGroup",
        method="POST",
        url="https://open.feishu.cn/open-apis/mail/v1/mailgroups",
        body=request,
        method_option=_new_method_option(options),
        need_tenant_access_token=True,
    )
