import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class StorageModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('StorageModule', 'storageModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'StorageModuleFilter', 'StorageModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'StorageModule',
            fieldName: 'storageModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('StorageModule', 'storageModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'StorageModuleFilter', 'StorageModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'StorageModule',
            fieldName: 'storageModule',
            document,
            variables,
            transform: (data) => ({
                storageModule: data.storageModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('StorageModule', 'storageModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'StorageModuleFilter', 'StorageModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'StorageModule',
            fieldName: 'storageModule',
            document,
            variables,
            transform: (data) => ({
                storageModule: data.storageModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('StorageModule', 'createStorageModule', 'storageModule', args.select, args.data, 'CreateStorageModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'StorageModule',
            fieldName: 'createStorageModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('StorageModule', 'updateStorageModule', 'storageModule', args.select, args.where.id, args.data, 'UpdateStorageModuleInput', 'id', 'storageModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'StorageModule',
            fieldName: 'updateStorageModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('StorageModule', 'deleteStorageModule', 'storageModule', {
            id: args.where.id,
        }, 'DeleteStorageModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'StorageModule',
            fieldName: 'deleteStorageModule',
            document,
            variables,
        });
    }
}
