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

// GetPerformanceSemesterList 获取周期的基本信息
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/performance-v1/semester/list
func (r *PerformanceService) GetPerformanceSemesterList(ctx context.Context, request *GetPerformanceSemesterListReq, options ...MethodOptionFunc) (*GetPerformanceSemesterListResp, *Response, error) {
	if r.cli.mock.mockPerformanceGetPerformanceSemesterList != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Performance#GetPerformanceSemesterList mock enable")
		return r.cli.mock.mockPerformanceGetPerformanceSemesterList(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Performance",
		API:                   "GetPerformanceSemesterList",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/performance/v1/semesters",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(getPerformanceSemesterListResp)

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

// MockPerformanceGetPerformanceSemesterList mock PerformanceGetPerformanceSemesterList method
func (r *Mock) MockPerformanceGetPerformanceSemesterList(f func(ctx context.Context, request *GetPerformanceSemesterListReq, options ...MethodOptionFunc) (*GetPerformanceSemesterListResp, *Response, error)) {
	r.mockPerformanceGetPerformanceSemesterList = f
}

// UnMockPerformanceGetPerformanceSemesterList un-mock PerformanceGetPerformanceSemesterList method
func (r *Mock) UnMockPerformanceGetPerformanceSemesterList() {
	r.mockPerformanceGetPerformanceSemesterList = nil
}

// GetPerformanceSemesterListReq ...
type GetPerformanceSemesterListReq struct {
	StartTime *string `query:"start_time" json:"-"` // 查询范围的开始时间, 毫秒级时间戳。开始时间不能晚于结束时间, 示例值: 1630425599999
	EndTime   *string `query:"end_time" json:"-"`   // 查询范围的结束时间, 毫秒级时间戳。结束时间不能早于开始时间, 示例值: 1630425599999
}

// GetPerformanceSemesterListResp ...
type GetPerformanceSemesterListResp struct {
	Items []*GetPerformanceSemesterListRespItem `json:"items,omitempty"` // 周期 meta 信息列表
}

// GetPerformanceSemesterListRespItem ...
type GetPerformanceSemesterListRespItem struct {
	ID         string                                  `json:"id,omitempty"`          // 绩效评估周期的 ID
	Name       *GetPerformanceSemesterListRespItemName `json:"name,omitempty"`        // 绩效评估周期的名称
	StartTime  string                                  `json:"start_time,omitempty"`  // 绩效评估周期的开始时间
	EndTime    string                                  `json:"end_time,omitempty"`    // 绩效评估周期的结束时间
	CreateTime string                                  `json:"create_time,omitempty"` // 绩效评估周期的创建时间
}

// GetPerformanceSemesterListRespItemName ...
type GetPerformanceSemesterListRespItemName struct {
	ZhCn string `json:"zh-CN,omitempty"` // 中文
	EnUs string `json:"en-US,omitempty"` // 英文
}

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