"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionExecutionLogModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class FunctionExecutionLogModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('FunctionExecutionLog', 'functionExecutionLogs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionExecutionLogFilter', 'FunctionExecutionLogOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionExecutionLog',
            fieldName: 'functionExecutionLogs',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('FunctionExecutionLog', 'functionExecutionLogs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionExecutionLogFilter', 'FunctionExecutionLogOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionExecutionLog',
            fieldName: 'functionExecutionLog',
            document,
            variables,
            transform: (data) => ({
                functionExecutionLog: data.functionExecutionLogs?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('FunctionExecutionLog', 'functionExecutionLogs', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionExecutionLogFilter', 'FunctionExecutionLogOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionExecutionLog',
            fieldName: 'functionExecutionLog',
            document,
            variables,
            transform: (data) => ({
                functionExecutionLog: data.functionExecutionLogs?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('FunctionExecutionLog', 'createFunctionExecutionLog', 'functionExecutionLog', args.select, args.data, 'CreateFunctionExecutionLogInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionExecutionLog',
            fieldName: 'createFunctionExecutionLog',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('FunctionExecutionLog', 'updateFunctionExecutionLog', 'functionExecutionLog', args.select, args.where.id, args.data, 'UpdateFunctionExecutionLogInput', 'id', 'functionExecutionLogPatch', input_types_1.connectionFieldsMap, {
            createdAt: args.where.createdAt,
        });
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionExecutionLog',
            fieldName: 'updateFunctionExecutionLog',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('FunctionExecutionLog', 'deleteFunctionExecutionLog', 'functionExecutionLog', {
            id: args.where.id,
            createdAt: args.where.createdAt,
        }, 'DeleteFunctionExecutionLogInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionExecutionLog',
            fieldName: 'deleteFunctionExecutionLog',
            document,
            variables,
        });
    }
}
exports.FunctionExecutionLogModel = FunctionExecutionLogModel;
