import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class InfraCommitModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('InfraCommit', 'infraCommits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'InfraCommitFilter', 'InfraCommitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InfraCommit',
            fieldName: 'infraCommits',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('InfraCommit', 'infraCommits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'InfraCommitFilter', 'InfraCommitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InfraCommit',
            fieldName: 'infraCommit',
            document,
            variables,
            transform: (data) => ({
                infraCommit: data.infraCommits?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('InfraCommit', 'infraCommits', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'InfraCommitFilter', 'InfraCommitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InfraCommit',
            fieldName: 'infraCommit',
            document,
            variables,
            transform: (data) => ({
                infraCommit: data.infraCommits?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('InfraCommit', 'createInfraCommit', 'infraCommit', args.select, args.data, 'CreateInfraCommitInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InfraCommit',
            fieldName: 'createInfraCommit',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('InfraCommit', 'updateInfraCommit', 'infraCommit', args.select, args.where.id, args.data, 'UpdateInfraCommitInput', 'id', 'infraCommitPatch', connectionFieldsMap, {
            scopeId: args.where.scopeId,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InfraCommit',
            fieldName: 'updateInfraCommit',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('InfraCommit', 'deleteInfraCommit', 'infraCommit', {
            id: args.where.id,
            scopeId: args.where.scopeId,
        }, 'DeleteInfraCommitInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InfraCommit',
            fieldName: 'deleteInfraCommit',
            document,
            variables,
        });
    }
}
