import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class WebauthnAuthModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('WebauthnAuthModule', 'webauthnAuthModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'WebauthnAuthModuleFilter', 'WebauthnAuthModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnAuthModule',
            fieldName: 'webauthnAuthModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('WebauthnAuthModule', 'webauthnAuthModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'WebauthnAuthModuleFilter', 'WebauthnAuthModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnAuthModule',
            fieldName: 'webauthnAuthModule',
            document,
            variables,
            transform: (data) => ({
                webauthnAuthModule: data.webauthnAuthModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('WebauthnAuthModule', 'webauthnAuthModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'WebauthnAuthModuleFilter', 'WebauthnAuthModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnAuthModule',
            fieldName: 'webauthnAuthModule',
            document,
            variables,
            transform: (data) => ({
                webauthnAuthModule: data.webauthnAuthModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('WebauthnAuthModule', 'createWebauthnAuthModule', 'webauthnAuthModule', args.select, args.data, 'CreateWebauthnAuthModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnAuthModule',
            fieldName: 'createWebauthnAuthModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('WebauthnAuthModule', 'updateWebauthnAuthModule', 'webauthnAuthModule', args.select, args.where.id, args.data, 'UpdateWebauthnAuthModuleInput', 'id', 'webauthnAuthModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnAuthModule',
            fieldName: 'updateWebauthnAuthModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('WebauthnAuthModule', 'deleteWebauthnAuthModule', 'webauthnAuthModule', {
            id: args.where.id,
        }, 'DeleteWebauthnAuthModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnAuthModule',
            fieldName: 'deleteWebauthnAuthModule',
            document,
            variables,
        });
    }
}
