// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
 * Copyright 2022 chyroc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package lark

import (
	"context"
)

// CreateHireReferralAccount 支持通过内推人的手机号或邮箱注册「内推奖励账号」。注册后, 可获取对应内推人的账号 ID, 并查询、操作对应内推人的积分和奖励余额, 配合接口: [「内推账户余额变更事件」](https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/referral_account/events/assets_update)、[「全额提取内推账号余额」](https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/referral_account/withdraw)。如需停用账户, 可调用[「停用外部系统内推账户」](https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/referral_account/deactivate)
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/referral_account/create
func (r *HireService) CreateHireReferralAccount(ctx context.Context, request *CreateHireReferralAccountReq, options ...MethodOptionFunc) (*CreateHireReferralAccountResp, *Response, error) {
	if r.cli.mock.mockHireCreateHireReferralAccount != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Hire#CreateHireReferralAccount mock enable")
		return r.cli.mock.mockHireCreateHireReferralAccount(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Hire",
		API:                   "CreateHireReferralAccount",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/hire/v1/referral_account",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(createHireReferralAccountResp)

	response, err := r.cli.RawRequest(ctx, req, resp)
	return resp.Data, response, err
}

// MockHireCreateHireReferralAccount mock HireCreateHireReferralAccount method
func (r *Mock) MockHireCreateHireReferralAccount(f func(ctx context.Context, request *CreateHireReferralAccountReq, options ...MethodOptionFunc) (*CreateHireReferralAccountResp, *Response, error)) {
	r.mockHireCreateHireReferralAccount = f
}

// UnMockHireCreateHireReferralAccount un-mock HireCreateHireReferralAccount method
func (r *Mock) UnMockHireCreateHireReferralAccount() {
	r.mockHireCreateHireReferralAccount = nil
}

// CreateHireReferralAccountReq ...
type CreateHireReferralAccountReq struct {
	Mobile *CreateHireReferralAccountReqMobile `json:"mobile,omitempty"` // 电话
	Email  *string                             `json:"email,omitempty"`  // 邮箱, 示例值: "hire@open.com"
}

// CreateHireReferralAccountReqMobile ...
type CreateHireReferralAccountReqMobile struct {
	Code   *string `json:"code,omitempty"`   // 国家代码, 示例值: "86"
	Number *string `json:"number,omitempty"` // 手机号码, 示例值: "18900001111"
}

// CreateHireReferralAccountResp ...
type CreateHireReferralAccountResp struct {
	Account *CreateHireReferralAccountRespAccount `json:"account,omitempty"` // 账号信息
}

// CreateHireReferralAccountRespAccount ...
type CreateHireReferralAccountRespAccount struct {
	AccountID string                                      `json:"account_id,omitempty"` // 账户ID
	Assets    *CreateHireReferralAccountRespAccountAssets `json:"assets,omitempty"`     // 账户资产
	Status    int64                                       `json:"status,omitempty"`     // 账号状态, 可选值有: 1: 可用, 2: 停用
}

// CreateHireReferralAccountRespAccountAssets ...
type CreateHireReferralAccountRespAccountAssets struct {
	ConfirmedBonus *CreateHireReferralAccountRespAccountAssetsConfirmedBonus `json:"confirmed_bonus,omitempty"` // 已确认的奖励
}

// CreateHireReferralAccountRespAccountAssetsConfirmedBonus ...
type CreateHireReferralAccountRespAccountAssetsConfirmedBonus struct {
	PointBonus int64 `json:"point_bonus,omitempty"` // 积分奖励
}

// createHireReferralAccountResp ...
type createHireReferralAccountResp struct {
	Code  int64                          `json:"code,omitempty"` // 错误码, 非 0 表示失败
	Msg   string                         `json:"msg,omitempty"`  // 错误描述
	Data  *CreateHireReferralAccountResp `json:"data,omitempty"`
	Error *ErrorDetail                   `json:"error,omitempty"`
}
