import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FunctionExecutionLogModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = 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', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionExecutionLog',
            fieldName: 'functionExecutionLogs',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FunctionExecutionLog', 'functionExecutionLogs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionExecutionLogFilter', 'FunctionExecutionLogOrderBy', connectionFieldsMap);
        return new 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 } = buildFindManyDocument('FunctionExecutionLog', 'functionExecutionLogs', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionExecutionLogFilter', 'FunctionExecutionLogOrderBy', connectionFieldsMap);
        return new 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 } = buildCreateDocument('FunctionExecutionLog', 'createFunctionExecutionLog', 'functionExecutionLog', args.select, args.data, 'CreateFunctionExecutionLogInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionExecutionLog',
            fieldName: 'createFunctionExecutionLog',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FunctionExecutionLog', 'updateFunctionExecutionLog', 'functionExecutionLog', args.select, args.where.id, args.data, 'UpdateFunctionExecutionLogInput', 'id', 'functionExecutionLogPatch', connectionFieldsMap, {
            createdAt: args.where.createdAt,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionExecutionLog',
            fieldName: 'updateFunctionExecutionLog',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FunctionExecutionLog', 'deleteFunctionExecutionLog', 'functionExecutionLog', {
            id: args.where.id,
            createdAt: args.where.createdAt,
        }, 'DeleteFunctionExecutionLogInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionExecutionLog',
            fieldName: 'deleteFunctionExecutionLog',
            document,
            variables,
        });
    }
}
