import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformInfraRefModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformInfraRef', 'platformInfraRefs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformInfraRefFilter', 'PlatformInfraRefOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraRef',
            fieldName: 'platformInfraRefs',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformInfraRef', 'platformInfraRefs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformInfraRefFilter', 'PlatformInfraRefOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraRef',
            fieldName: 'platformInfraRef',
            document,
            variables,
            transform: (data) => ({
                platformInfraRef: data.platformInfraRefs?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformInfraRef', 'platformInfraRefs', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformInfraRefFilter', 'PlatformInfraRefOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformInfraRef',
            fieldName: 'platformInfraRef',
            document,
            variables,
            transform: (data) => ({
                platformInfraRef: data.platformInfraRefs?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformInfraRef', 'createPlatformInfraRef', 'platformInfraRef', args.select, args.data, 'CreatePlatformInfraRefInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraRef',
            fieldName: 'createPlatformInfraRef',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformInfraRef', 'updatePlatformInfraRef', 'platformInfraRef', args.select, args.where.id, args.data, 'UpdatePlatformInfraRefInput', 'id', 'platformInfraRefPatch', connectionFieldsMap, {
            scopeId: args.where.scopeId,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraRef',
            fieldName: 'updatePlatformInfraRef',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformInfraRef', 'deletePlatformInfraRef', 'platformInfraRef', {
            id: args.where.id,
            scopeId: args.where.scopeId,
        }, 'DeletePlatformInfraRefInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformInfraRef',
            fieldName: 'deletePlatformInfraRef',
            document,
            variables,
        });
    }
}
