"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ListFormSchemasByCreatorResponseBodyResult = exports.ListFormSchemasByCreatorResponseBodyResultList = exports.ListFormSchemasByCreatorResponseBodyResultListSetting = exports.ListFormInstancesResponseBodyResult = exports.ListFormInstancesResponseBodyResultList = exports.ListFormInstancesResponseBodyResultListForms = exports.GetFormInstanceResponseBodyResult = exports.GetFormInstanceResponseBodyResultForms = exports.ListFormSchemasByCreatorResponse = exports.ListFormSchemasByCreatorResponseBody = exports.ListFormSchemasByCreatorRequest = exports.ListFormSchemasByCreatorHeaders = exports.ListFormInstancesResponse = exports.ListFormInstancesResponseBody = exports.ListFormInstancesRequest = exports.ListFormInstancesHeaders = exports.GetFormInstanceResponse = exports.GetFormInstanceResponseBody = exports.GetFormInstanceRequest = exports.GetFormInstanceHeaders = void 0;
// This file is auto-generated, don't edit it
/**
 */
const tea_util_1 = __importStar(require("@alicloud/tea-util")), $Util = tea_util_1;
const gateway_dingtalk_1 = __importDefault(require("@alicloud/gateway-dingtalk"));
const openapi_client_1 = __importStar(require("@alicloud/openapi-client")), $OpenApi = openapi_client_1;
const openapi_util_1 = __importDefault(require("@alicloud/openapi-util"));
const $tea = __importStar(require("@alicloud/tea-typescript"));
class GetFormInstanceHeaders extends $tea.Model {
    static names() {
        return {
            commonHeaders: 'commonHeaders',
            xAcsDingtalkAccessToken: 'x-acs-dingtalk-access-token',
        };
    }
    static types() {
        return {
            commonHeaders: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            xAcsDingtalkAccessToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetFormInstanceHeaders = GetFormInstanceHeaders;
class GetFormInstanceRequest extends $tea.Model {
    static names() {
        return {
            bizType: 'bizType',
        };
    }
    static types() {
        return {
            bizType: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetFormInstanceRequest = GetFormInstanceRequest;
class GetFormInstanceResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
            success: 'success',
        };
    }
    static types() {
        return {
            result: GetFormInstanceResponseBodyResult,
            success: 'boolean',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetFormInstanceResponseBody = GetFormInstanceResponseBody;
class GetFormInstanceResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
            body: 'body',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
            body: GetFormInstanceResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetFormInstanceResponse = GetFormInstanceResponse;
class ListFormInstancesHeaders extends $tea.Model {
    static names() {
        return {
            commonHeaders: 'commonHeaders',
            xAcsDingtalkAccessToken: 'x-acs-dingtalk-access-token',
        };
    }
    static types() {
        return {
            commonHeaders: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            xAcsDingtalkAccessToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormInstancesHeaders = ListFormInstancesHeaders;
class ListFormInstancesRequest extends $tea.Model {
    static names() {
        return {
            actionDate: 'actionDate',
            bizType: 'bizType',
            maxResults: 'maxResults',
            nextToken: 'nextToken',
        };
    }
    static types() {
        return {
            actionDate: 'string',
            bizType: 'number',
            maxResults: 'number',
            nextToken: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormInstancesRequest = ListFormInstancesRequest;
class ListFormInstancesResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
            success: 'success',
        };
    }
    static types() {
        return {
            result: ListFormInstancesResponseBodyResult,
            success: 'boolean',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormInstancesResponseBody = ListFormInstancesResponseBody;
class ListFormInstancesResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
            body: 'body',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
            body: ListFormInstancesResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormInstancesResponse = ListFormInstancesResponse;
class ListFormSchemasByCreatorHeaders extends $tea.Model {
    static names() {
        return {
            commonHeaders: 'commonHeaders',
            xAcsDingtalkAccessToken: 'x-acs-dingtalk-access-token',
        };
    }
    static types() {
        return {
            commonHeaders: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            xAcsDingtalkAccessToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormSchemasByCreatorHeaders = ListFormSchemasByCreatorHeaders;
class ListFormSchemasByCreatorRequest extends $tea.Model {
    static names() {
        return {
            bizType: 'bizType',
            creator: 'creator',
            maxResults: 'maxResults',
            nextToken: 'nextToken',
        };
    }
    static types() {
        return {
            bizType: 'number',
            creator: 'string',
            maxResults: 'number',
            nextToken: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormSchemasByCreatorRequest = ListFormSchemasByCreatorRequest;
class ListFormSchemasByCreatorResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
            success: 'success',
        };
    }
    static types() {
        return {
            result: ListFormSchemasByCreatorResponseBodyResult,
            success: 'boolean',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormSchemasByCreatorResponseBody = ListFormSchemasByCreatorResponseBody;
class ListFormSchemasByCreatorResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
            body: 'body',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
            body: ListFormSchemasByCreatorResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormSchemasByCreatorResponse = ListFormSchemasByCreatorResponse;
class GetFormInstanceResponseBodyResultForms extends $tea.Model {
    static names() {
        return {
            key: 'key',
            label: 'label',
            value: 'value',
        };
    }
    static types() {
        return {
            key: 'string',
            label: 'string',
            value: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetFormInstanceResponseBodyResultForms = GetFormInstanceResponseBodyResultForms;
class GetFormInstanceResponseBodyResult extends $tea.Model {
    static names() {
        return {
            createTime: 'createTime',
            creator: 'creator',
            formCode: 'formCode',
            forms: 'forms',
            modifyTime: 'modifyTime',
            title: 'title',
        };
    }
    static types() {
        return {
            createTime: 'string',
            creator: 'string',
            formCode: 'string',
            forms: { 'type': 'array', 'itemType': GetFormInstanceResponseBodyResultForms },
            modifyTime: 'string',
            title: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetFormInstanceResponseBodyResult = GetFormInstanceResponseBodyResult;
class ListFormInstancesResponseBodyResultListForms extends $tea.Model {
    static names() {
        return {
            key: 'key',
            label: 'label',
            value: 'value',
        };
    }
    static types() {
        return {
            key: 'string',
            label: 'string',
            value: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormInstancesResponseBodyResultListForms = ListFormInstancesResponseBodyResultListForms;
class ListFormInstancesResponseBodyResultList extends $tea.Model {
    static names() {
        return {
            createTime: 'createTime',
            formCode: 'formCode',
            formInstanceId: 'formInstanceId',
            forms: 'forms',
            modifyTime: 'modifyTime',
            studentClassId: 'studentClassId',
            studentClassName: 'studentClassName',
            studentName: 'studentName',
            studentUserId: 'studentUserId',
            submitterUserId: 'submitterUserId',
            submitterUserName: 'submitterUserName',
            title: 'title',
        };
    }
    static types() {
        return {
            createTime: 'string',
            formCode: 'string',
            formInstanceId: 'string',
            forms: { 'type': 'array', 'itemType': ListFormInstancesResponseBodyResultListForms },
            modifyTime: 'string',
            studentClassId: 'string',
            studentClassName: 'string',
            studentName: 'string',
            studentUserId: 'string',
            submitterUserId: 'string',
            submitterUserName: 'string',
            title: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormInstancesResponseBodyResultList = ListFormInstancesResponseBodyResultList;
class ListFormInstancesResponseBodyResult extends $tea.Model {
    static names() {
        return {
            hasMore: 'hasMore',
            list: 'list',
            nextToken: 'nextToken',
        };
    }
    static types() {
        return {
            hasMore: 'boolean',
            list: { 'type': 'array', 'itemType': ListFormInstancesResponseBodyResultList },
            nextToken: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormInstancesResponseBodyResult = ListFormInstancesResponseBodyResult;
class ListFormSchemasByCreatorResponseBodyResultListSetting extends $tea.Model {
    static names() {
        return {
            bizType: 'bizType',
            createTime: 'createTime',
            endTime: 'endTime',
            formType: 'formType',
            loopDays: 'loopDays',
            loopTime: 'loopTime',
            stop: 'stop',
        };
    }
    static types() {
        return {
            bizType: 'number',
            createTime: 'string',
            endTime: 'string',
            formType: 'number',
            loopDays: { 'type': 'array', 'itemType': 'number' },
            loopTime: 'string',
            stop: 'boolean',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormSchemasByCreatorResponseBodyResultListSetting = ListFormSchemasByCreatorResponseBodyResultListSetting;
class ListFormSchemasByCreatorResponseBodyResultList extends $tea.Model {
    static names() {
        return {
            creator: 'creator',
            formCode: 'formCode',
            memo: 'memo',
            name: 'name',
            setting: 'setting',
        };
    }
    static types() {
        return {
            creator: 'string',
            formCode: 'string',
            memo: 'string',
            name: 'string',
            setting: ListFormSchemasByCreatorResponseBodyResultListSetting,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormSchemasByCreatorResponseBodyResultList = ListFormSchemasByCreatorResponseBodyResultList;
class ListFormSchemasByCreatorResponseBodyResult extends $tea.Model {
    static names() {
        return {
            hasMore: 'hasMore',
            list: 'list',
            nextToken: 'nextToken',
        };
    }
    static types() {
        return {
            hasMore: 'boolean',
            list: { 'type': 'array', 'itemType': ListFormSchemasByCreatorResponseBodyResultList },
            nextToken: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListFormSchemasByCreatorResponseBodyResult = ListFormSchemasByCreatorResponseBodyResult;
class Client extends openapi_client_1.default {
    constructor(config) {
        super(config);
        let gatewayClient = new gateway_dingtalk_1.default();
        this._spi = gatewayClient;
        this._endpointRule = "";
        if (tea_util_1.default.empty(this._endpoint)) {
            this._endpoint = "api.dingtalk.com";
        }
    }
    /**
     * 获取单个填表实例详情接口
     *
     * @param request - GetFormInstanceRequest
     * @param headers - GetFormInstanceHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns GetFormInstanceResponse
     */
    async getFormInstanceWithOptions(formInstanceId, request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.bizType)) {
            query["bizType"] = request.bizType;
        }
        let realHeaders = {};
        if (!tea_util_1.default.isUnset(headers.commonHeaders)) {
            realHeaders = headers.commonHeaders;
        }
        if (!tea_util_1.default.isUnset(headers.xAcsDingtalkAccessToken)) {
            realHeaders["x-acs-dingtalk-access-token"] = tea_util_1.default.toJSONString(headers.xAcsDingtalkAccessToken);
        }
        let req = new $OpenApi.OpenApiRequest({
            headers: realHeaders,
            query: openapi_util_1.default.query(query),
        });
        let params = new $OpenApi.Params({
            action: "GetFormInstance",
            version: "swform_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/swform/instances/${formInstanceId}`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new GetFormInstanceResponse({}));
    }
    /**
     * 获取单个填表实例详情接口
     *
     * @param request - GetFormInstanceRequest
     * @returns GetFormInstanceResponse
     */
    async getFormInstance(formInstanceId, request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new GetFormInstanceHeaders({});
        return await this.getFormInstanceWithOptions(formInstanceId, request, headers, runtime);
    }
    /**
     * 获取填表模版下的填表实例列表接口
     *
     * @param request - ListFormInstancesRequest
     * @param headers - ListFormInstancesHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns ListFormInstancesResponse
     */
    async listFormInstancesWithOptions(formCode, request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.actionDate)) {
            query["actionDate"] = request.actionDate;
        }
        if (!tea_util_1.default.isUnset(request.bizType)) {
            query["bizType"] = request.bizType;
        }
        if (!tea_util_1.default.isUnset(request.maxResults)) {
            query["maxResults"] = request.maxResults;
        }
        if (!tea_util_1.default.isUnset(request.nextToken)) {
            query["nextToken"] = request.nextToken;
        }
        let realHeaders = {};
        if (!tea_util_1.default.isUnset(headers.commonHeaders)) {
            realHeaders = headers.commonHeaders;
        }
        if (!tea_util_1.default.isUnset(headers.xAcsDingtalkAccessToken)) {
            realHeaders["x-acs-dingtalk-access-token"] = tea_util_1.default.toJSONString(headers.xAcsDingtalkAccessToken);
        }
        let req = new $OpenApi.OpenApiRequest({
            headers: realHeaders,
            query: openapi_util_1.default.query(query),
        });
        let params = new $OpenApi.Params({
            action: "ListFormInstances",
            version: "swform_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/swform/forms/${formCode}/instances`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new ListFormInstancesResponse({}));
    }
    /**
     * 获取填表模版下的填表实例列表接口
     *
     * @param request - ListFormInstancesRequest
     * @returns ListFormInstancesResponse
     */
    async listFormInstances(formCode, request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new ListFormInstancesHeaders({});
        return await this.listFormInstancesWithOptions(formCode, request, headers, runtime);
    }
    /**
     * 获取用户创建的填表模板列表接口
     *
     * @param request - ListFormSchemasByCreatorRequest
     * @param headers - ListFormSchemasByCreatorHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns ListFormSchemasByCreatorResponse
     */
    async listFormSchemasByCreatorWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.bizType)) {
            query["bizType"] = request.bizType;
        }
        if (!tea_util_1.default.isUnset(request.creator)) {
            query["creator"] = request.creator;
        }
        if (!tea_util_1.default.isUnset(request.maxResults)) {
            query["maxResults"] = request.maxResults;
        }
        if (!tea_util_1.default.isUnset(request.nextToken)) {
            query["nextToken"] = request.nextToken;
        }
        let realHeaders = {};
        if (!tea_util_1.default.isUnset(headers.commonHeaders)) {
            realHeaders = headers.commonHeaders;
        }
        if (!tea_util_1.default.isUnset(headers.xAcsDingtalkAccessToken)) {
            realHeaders["x-acs-dingtalk-access-token"] = tea_util_1.default.toJSONString(headers.xAcsDingtalkAccessToken);
        }
        let req = new $OpenApi.OpenApiRequest({
            headers: realHeaders,
            query: openapi_util_1.default.query(query),
        });
        let params = new $OpenApi.Params({
            action: "ListFormSchemasByCreator",
            version: "swform_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/swform/users/forms`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new ListFormSchemasByCreatorResponse({}));
    }
    /**
     * 获取用户创建的填表模板列表接口
     *
     * @param request - ListFormSchemasByCreatorRequest
     * @returns ListFormSchemasByCreatorResponse
     */
    async listFormSchemasByCreator(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new ListFormSchemasByCreatorHeaders({});
        return await this.listFormSchemasByCreatorWithOptions(request, headers, runtime);
    }
}
exports.default = Client;
//# sourceMappingURL=client.js.map