"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AutoBeTestFunctionalProgrammer = void 0;
const typescript_1 = __importDefault(require("typescript"));
const ExpressionFactory_1 = require("typia/lib/factories/ExpressionFactory");
const AutoBeTestStatementProgrammer_1 = require("./AutoBeTestStatementProgrammer");
const writeTestExpression_1 = require("./writeTestExpression");
var AutoBeTestFunctionalProgrammer;
(function (AutoBeTestFunctionalProgrammer) {
    AutoBeTestFunctionalProgrammer.arrowFunction = (ctx, expr) => typescript_1.default.factory.createArrowFunction([typescript_1.default.factory.createModifier(typescript_1.default.SyntaxKind.AsyncKeyword)], undefined, [], undefined, undefined, AutoBeTestStatementProgrammer_1.AutoBeTestStatementProgrammer.block(ctx, expr.body));
    AutoBeTestFunctionalProgrammer.callExpression = (ctx, expr) => typescript_1.default.factory.createCallExpression((0, writeTestExpression_1.writeTestExpression)(ctx, expr.expression), undefined, expr.arguments.map((arg) => (0, writeTestExpression_1.writeTestExpression)(ctx, arg)));
    AutoBeTestFunctionalProgrammer.newExpression = (ctx, expr) => typescript_1.default.factory.createNewExpression((0, writeTestExpression_1.writeTestExpression)(ctx, expr.expression), undefined, expr.arguments.map((arg) => (0, writeTestExpression_1.writeTestExpression)(ctx, arg)));
    AutoBeTestFunctionalProgrammer.arrayFilterExpression = (ctx, expr) => arrayExpression(ctx, "asyncFilter", [expr.array, expr.function]);
    AutoBeTestFunctionalProgrammer.arrayForEachExpression = (ctx, expr) => arrayExpression(ctx, "asyncForEach", [expr.array, expr.function]);
    AutoBeTestFunctionalProgrammer.arrayMapExpression = (ctx, expr) => arrayExpression(ctx, "asyncMap", [expr.array, expr.function]);
    AutoBeTestFunctionalProgrammer.arrayRepeatExpression = (ctx, expr) => arrayExpression(ctx, "asyncRepeat", [expr.count, expr.function]);
})(AutoBeTestFunctionalProgrammer || (exports.AutoBeTestFunctionalProgrammer = AutoBeTestFunctionalProgrammer = {}));
const arrayExpression = (ctx, name, argList) => typescript_1.default.factory.createAwaitExpression(ExpressionFactory_1.ExpressionFactory.currying({
    function: typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createIdentifier(ctx.importer.external({
        type: "instance",
        library: "@nestia/e2e",
        name: "ArrayUtil",
    })), name),
    arguments: argList.map((a) => (0, writeTestExpression_1.writeTestExpression)(ctx, a)),
}));
//# sourceMappingURL=AutoBeTestFunctionalProgrammer.js.map