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

// GetCoreHRProcessList 查询流程实例列表。发起的流程为流程实例（process_id 是唯一标识）；配置的流程为流程定义（flow_definition_id 是唯一标识）。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/process/list
func (r *CoreHRService) GetCoreHRProcessList(ctx context.Context, request *GetCoreHRProcessListReq, options ...MethodOptionFunc) (*GetCoreHRProcessListResp, *Response, error) {
	if r.cli.mock.mockCoreHRGetCoreHRProcessList != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#GetCoreHRProcessList mock enable")
		return r.cli.mock.mockCoreHRGetCoreHRProcessList(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "CoreHR",
		API:                   "GetCoreHRProcessList",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/corehr/v2/processes",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(getCoreHRProcessListResp)

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

// MockCoreHRGetCoreHRProcessList mock CoreHRGetCoreHRProcessList method
func (r *Mock) MockCoreHRGetCoreHRProcessList(f func(ctx context.Context, request *GetCoreHRProcessListReq, options ...MethodOptionFunc) (*GetCoreHRProcessListResp, *Response, error)) {
	r.mockCoreHRGetCoreHRProcessList = f
}

// UnMockCoreHRGetCoreHRProcessList un-mock CoreHRGetCoreHRProcessList method
func (r *Mock) UnMockCoreHRGetCoreHRProcessList() {
	r.mockCoreHRGetCoreHRProcessList = nil
}

// GetCoreHRProcessListReq ...
type GetCoreHRProcessListReq struct {
	ModifyTimeTo     string  `query:"modify_time_to" json:"-"`     // 任务查询结束时间 (unix毫秒时间戳), 闭区间, 开始时间和结束时间跨度不能超过31天, 示例值: 1547654251506
	Statuses         []int64 `query:"statuses" json:"-"`           // 查询状态列表。如需一次查询多个状态值, 可通过将同一参数名多次传递, 并且每次传递不同的参数值。例如:https://{url}?statuses=1&statuses=2, 示例值: 1
	PageToken        *string `query:"page_token" json:"-"`         // 分页标记, 第一次请求不填, 表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token, 下次遍历可采用该 page_token 获取查询结果, 示例值: 7278949005675988535
	PageSize         int64   `query:"page_size" json:"-"`          // 分页大小, 示例值: 100, 最大值: `100`
	ModifyTimeFrom   string  `query:"modify_time_from" json:"-"`   // 查询开始时间（unix毫秒时间戳）, 闭区间, 开始时间和结束时间跨度不能超过31天, 示例值: 1547654251506
	FlowDefinitionID *string `query:"flow_definition_id" json:"-"` // 流程定义ID, 示例值: people_6961286846093788680_7081951411982077732
}

// GetCoreHRProcessListResp ...
type GetCoreHRProcessListResp struct {
	ProcessIDs []string `json:"process_ids,omitempty"` // 流程实例ID列表
	HasMore    bool     `json:"has_more,omitempty"`    // 是否还有更多项
	PageToken  string   `json:"page_token,omitempty"`  // 分页标记, 当 has_more 为 true 时, 会同时返回新的 page_token, 否则不返回 page_token
}

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