import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class ResourceInstallationModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('ResourceInstallation', 'resourceInstallations', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'ResourceInstallationFilter', 'ResourceInstallationOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ResourceInstallation',
            fieldName: 'resourceInstallations',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('ResourceInstallation', 'resourceInstallations', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'ResourceInstallationFilter', 'ResourceInstallationOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ResourceInstallation',
            fieldName: 'resourceInstallation',
            document,
            variables,
            transform: (data) => ({
                resourceInstallation: data.resourceInstallations?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('ResourceInstallation', 'resourceInstallations', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'ResourceInstallationFilter', 'ResourceInstallationOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ResourceInstallation',
            fieldName: 'resourceInstallation',
            document,
            variables,
            transform: (data) => ({
                resourceInstallation: data.resourceInstallations?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('ResourceInstallation', 'createResourceInstallation', 'resourceInstallation', args.select, args.data, 'CreateResourceInstallationInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ResourceInstallation',
            fieldName: 'createResourceInstallation',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('ResourceInstallation', 'updateResourceInstallation', 'resourceInstallation', args.select, args.where.id, args.data, 'UpdateResourceInstallationInput', 'id', 'resourceInstallationPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ResourceInstallation',
            fieldName: 'updateResourceInstallation',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('ResourceInstallation', 'deleteResourceInstallation', 'resourceInstallation', {
            id: args.where.id,
        }, 'DeleteResourceInstallationInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ResourceInstallation',
            fieldName: 'deleteResourceInstallation',
            document,
            variables,
        });
    }
}
