import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformInfraCommitModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformInfraCommit', 'platformInfraCommits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformInfraCommitFilter', 'PlatformInfraCommitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraCommit',
            fieldName: 'platformInfraCommits',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformInfraCommit', 'platformInfraCommits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformInfraCommitFilter', 'PlatformInfraCommitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraCommit',
            fieldName: 'platformInfraCommit',
            document,
            variables,
            transform: (data) => ({
                platformInfraCommit: data.platformInfraCommits?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformInfraCommit', 'platformInfraCommits', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformInfraCommitFilter', 'PlatformInfraCommitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraCommit',
            fieldName: 'platformInfraCommit',
            document,
            variables,
            transform: (data) => ({
                platformInfraCommit: data.platformInfraCommits?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformInfraCommit', 'createPlatformInfraCommit', 'platformInfraCommit', args.select, args.data, 'CreatePlatformInfraCommitInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraCommit',
            fieldName: 'createPlatformInfraCommit',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformInfraCommit', 'updatePlatformInfraCommit', 'platformInfraCommit', args.select, args.where.id, args.data, 'UpdatePlatformInfraCommitInput', 'id', 'platformInfraCommitPatch', connectionFieldsMap, {
            scopeId: args.where.scopeId,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraCommit',
            fieldName: 'updatePlatformInfraCommit',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformInfraCommit', 'deletePlatformInfraCommit', 'platformInfraCommit', {
            id: args.where.id,
            scopeId: args.where.scopeId,
        }, 'DeletePlatformInfraCommitInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraCommit',
            fieldName: 'deletePlatformInfraCommit',
            document,
            variables,
        });
    }
}
