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

// GetSheetFilter 获取子表的详细筛选信息
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/sheets-v3/spreadsheet-sheet-filter/get
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/spreadsheet-sheet-filter/get
func (r *DriveService) GetSheetFilter(ctx context.Context, request *GetSheetFilterReq, options ...MethodOptionFunc) (*GetSheetFilterResp, *Response, error) {
	if r.cli.mock.mockDriveGetSheetFilter != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#GetSheetFilter mock enable")
		return r.cli.mock.mockDriveGetSheetFilter(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "GetSheetFilter",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/sheets/v3/spreadsheets/:spreadsheet_token/sheets/:sheet_id/filter",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getSheetFilterResp)

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

// MockDriveGetSheetFilter mock DriveGetSheetFilter method
func (r *Mock) MockDriveGetSheetFilter(f func(ctx context.Context, request *GetSheetFilterReq, options ...MethodOptionFunc) (*GetSheetFilterResp, *Response, error)) {
	r.mockDriveGetSheetFilter = f
}

// UnMockDriveGetSheetFilter un-mock DriveGetSheetFilter method
func (r *Mock) UnMockDriveGetSheetFilter() {
	r.mockDriveGetSheetFilter = nil
}

// GetSheetFilterReq ...
type GetSheetFilterReq struct {
	SpreadSheetToken string `path:"spreadsheet_token" json:"-"` // 表格 token, 示例值: "shtcnmBA\*yGehy8"
	SheetID          string `path:"sheet_id" json:"-"`          // 子表 id, 示例值: "0b\**12"
}

// GetSheetFilterResp ...
type GetSheetFilterResp struct {
	SheetFilterInfo *GetSheetFilterRespSheetFilterInfo `json:"sheet_filter_info,omitempty"` // 筛选信息
}

// GetSheetFilterRespSheetFilterInfo ...
type GetSheetFilterRespSheetFilterInfo struct {
	Range           string                                         `json:"range,omitempty"`             // 筛选应用范围
	FilteredOutRows []int64                                        `json:"filtered_out_rows,omitempty"` // 筛选出来隐藏的行
	FilterInfos     []*GetSheetFilterRespSheetFilterInfoFilterInfo `json:"filter_infos,omitempty"`      // sheet的筛选条件
}

// GetSheetFilterRespSheetFilterInfoFilterInfo ...
type GetSheetFilterRespSheetFilterInfoFilterInfo struct {
	Col        string                                                  `json:"col,omitempty"`        // 设置了筛选条件的列
	Conditions []*GetSheetFilterRespSheetFilterInfoFilterInfoCondition `json:"conditions,omitempty"` // 筛选条件
}

// GetSheetFilterRespSheetFilterInfoFilterInfoCondition ...
type GetSheetFilterRespSheetFilterInfoFilterInfoCondition struct {
	FilterType  string   `json:"filter_type,omitempty"`  // 筛选类型
	CompareType string   `json:"compare_type,omitempty"` // 比较类型
	Expected    []string `json:"expected,omitempty"`     // 筛选参数
}

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