// 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"
)

// UpdateHiredEcoExamResult 回传笔试结果。回传笔试结果后, 若需更新笔试结果, 可再次调用该接口更新笔试结果, 更新后的数据将覆盖原数据。用户若已在飞书招聘完成阅卷, 不再支持回传笔试结果。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/eco_exam/update_result
// new doc: https://open.feishu.cn/document/server-docs/hire-v1/ecological-docking/eco_exam/update_result
func (r *HireService) UpdateHiredEcoExamResult(ctx context.Context, request *UpdateHiredEcoExamResultReq, options ...MethodOptionFunc) (*UpdateHiredEcoExamResultResp, *Response, error) {
	if r.cli.mock.mockHireUpdateHiredEcoExamResult != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Hire#UpdateHiredEcoExamResult mock enable")
		return r.cli.mock.mockHireUpdateHiredEcoExamResult(ctx, request, options...)
	}

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

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

// MockHireUpdateHiredEcoExamResult mock HireUpdateHiredEcoExamResult method
func (r *Mock) MockHireUpdateHiredEcoExamResult(f func(ctx context.Context, request *UpdateHiredEcoExamResultReq, options ...MethodOptionFunc) (*UpdateHiredEcoExamResultResp, *Response, error)) {
	r.mockHireUpdateHiredEcoExamResult = f
}

// UnMockHireUpdateHiredEcoExamResult un-mock HireUpdateHiredEcoExamResult method
func (r *Mock) UnMockHireUpdateHiredEcoExamResult() {
	r.mockHireUpdateHiredEcoExamResult = nil
}

// UpdateHiredEcoExamResultReq ...
type UpdateHiredEcoExamResultReq struct {
	ExamID     string                               `path:"exam_id" json:"-"`      // exam id, 示例值: "7178536692385679677"
	Result     string                               `json:"result,omitempty"`      // 笔试结果, 推荐传"0"-"100" 的数字(字符串格式), 如"60", "90", 该字段表示该场笔试考生考试的成绩, 示例值: "60.5"
	ResultTime *string                              `json:"result_time,omitempty"` // 笔试结果时间, 示例值: "1658676234053"
	ReportList []*UpdateHiredEcoExamResultReqReport `json:"report_list,omitempty"` // 报告列表
	DetailList []*UpdateHiredEcoExamResultReqDetail `json:"detail_list,omitempty"` // 详细评价结果
}

// UpdateHiredEcoExamResultReqDetail ...
type UpdateHiredEcoExamResultReqDetail struct {
	ID     *string `json:"id,omitempty"`     // 评价 ID, 示例值: "pj001"
	Name   string  `json:"name,omitempty"`   // 评价名称, 示例值: "基本功"
	Result string  `json:"result,omitempty"` // 评价结果, 示例值: "优秀"
}

// UpdateHiredEcoExamResultReqReport ...
type UpdateHiredEcoExamResultReqReport struct {
	Name       string  `json:"name,omitempty"`        // 报告名称, 示例值: "阶段报告.pdf"
	URL        string  `json:"url,omitempty"`         // 报告链接, 示例值: "https://xxxxx/xxxxxx/xxxx.pdf"
	AnswerTime *string `json:"answer_time,omitempty"` // 作答完成时间(毫秒时间戳), 示例值: "1658676234053"
}

// UpdateHiredEcoExamResultResp ...
type UpdateHiredEcoExamResultResp struct {
}

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