import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FunctionGraphExecutionNodeStateModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraphExecutionNodeState', 'functionGraphExecutionNodeStates', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionGraphExecutionNodeStateFilter', 'FunctionGraphExecutionNodeStateOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecutionNodeState',
            fieldName: 'functionGraphExecutionNodeStates',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FunctionGraphExecutionNodeState', 'functionGraphExecutionNodeStates', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionGraphExecutionNodeStateFilter', 'FunctionGraphExecutionNodeStateOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecutionNodeState',
            fieldName: 'functionGraphExecutionNodeState',
            document,
            variables,
            transform: (data) => ({
                functionGraphExecutionNodeState: data.functionGraphExecutionNodeStates?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraphExecutionNodeState', 'functionGraphExecutionNodeStates', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionGraphExecutionNodeStateFilter', 'FunctionGraphExecutionNodeStateOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecutionNodeState',
            fieldName: 'functionGraphExecutionNodeState',
            document,
            variables,
            transform: (data) => ({
                functionGraphExecutionNodeState: data.functionGraphExecutionNodeStates?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('FunctionGraphExecutionNodeState', 'createFunctionGraphExecutionNodeState', 'functionGraphExecutionNodeState', args.select, args.data, 'CreateFunctionGraphExecutionNodeStateInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecutionNodeState',
            fieldName: 'createFunctionGraphExecutionNodeState',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FunctionGraphExecutionNodeState', 'updateFunctionGraphExecutionNodeState', 'functionGraphExecutionNodeState', args.select, args.where.id, args.data, 'UpdateFunctionGraphExecutionNodeStateInput', 'id', 'functionGraphExecutionNodeStatePatch', connectionFieldsMap, {
            createdAt: args.where.createdAt,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecutionNodeState',
            fieldName: 'updateFunctionGraphExecutionNodeState',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FunctionGraphExecutionNodeState', 'deleteFunctionGraphExecutionNodeState', 'functionGraphExecutionNodeState', {
            id: args.where.id,
            createdAt: args.where.createdAt,
        }, 'DeleteFunctionGraphExecutionNodeStateInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecutionNodeState',
            fieldName: 'deleteFunctionGraphExecutionNodeState',
            document,
            variables,
        });
    }
}
