import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildFindOneDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformInfraObjectModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformInfraObject', 'platformInfraObjects', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformInfraObjectFilter', 'PlatformInfraObjectOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraObject',
            fieldName: 'platformInfraObjects',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformInfraObject', 'platformInfraObjects', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformInfraObjectFilter', 'PlatformInfraObjectOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraObject',
            fieldName: 'platformInfraObject',
            document,
            variables,
            transform: (data) => ({
                platformInfraObject: data.platformInfraObjects?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindOneDocument('PlatformInfraObject', 'platformInfraGetNodeAtPath', args.id, args.select, 'id', 'UUID!', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraObject',
            fieldName: 'platformInfraObject',
            document,
            variables,
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformInfraObject', 'createPlatformInfraObject', 'platformInfraObject', args.select, args.data, 'CreatePlatformInfraObjectInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraObject',
            fieldName: 'createPlatformInfraObject',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformInfraObject', 'updatePlatformInfraObject', 'platformInfraObject', args.select, args.where.id, args.data, 'UpdatePlatformInfraObjectInput', 'id', 'platformInfraObjectPatch', connectionFieldsMap, {
            scopeId: args.where.scopeId,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraObject',
            fieldName: 'updatePlatformInfraObject',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformInfraObject', 'deletePlatformInfraObject', 'platformInfraObject', {
            id: args.where.id,
            scopeId: args.where.scopeId,
        }, 'DeletePlatformInfraObjectInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraObject',
            fieldName: 'deletePlatformInfraObject',
            document,
            variables,
        });
    }
}
