import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class RealtimeModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('RealtimeModule', 'realtimeModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'RealtimeModuleFilter', 'RealtimeModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RealtimeModule',
            fieldName: 'realtimeModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('RealtimeModule', 'realtimeModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'RealtimeModuleFilter', 'RealtimeModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RealtimeModule',
            fieldName: 'realtimeModule',
            document,
            variables,
            transform: (data) => ({
                realtimeModule: data.realtimeModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('RealtimeModule', 'realtimeModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'RealtimeModuleFilter', 'RealtimeModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RealtimeModule',
            fieldName: 'realtimeModule',
            document,
            variables,
            transform: (data) => ({
                realtimeModule: data.realtimeModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('RealtimeModule', 'createRealtimeModule', 'realtimeModule', args.select, args.data, 'CreateRealtimeModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RealtimeModule',
            fieldName: 'createRealtimeModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('RealtimeModule', 'updateRealtimeModule', 'realtimeModule', args.select, args.where.id, args.data, 'UpdateRealtimeModuleInput', 'id', 'realtimeModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RealtimeModule',
            fieldName: 'updateRealtimeModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('RealtimeModule', 'deleteRealtimeModule', 'realtimeModule', {
            id: args.where.id,
        }, 'DeleteRealtimeModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RealtimeModule',
            fieldName: 'deleteRealtimeModule',
            document,
            variables,
        });
    }
}
