import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class DbPresetModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('DbPreset', 'dbPresets', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'DbPresetFilter', 'DbPresetOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DbPreset',
            fieldName: 'dbPresets',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('DbPreset', 'dbPresets', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'DbPresetFilter', 'DbPresetOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DbPreset',
            fieldName: 'dbPreset',
            document,
            variables,
            transform: (data) => ({
                dbPreset: data.dbPresets?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('DbPreset', 'dbPresets', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'DbPresetFilter', 'DbPresetOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DbPreset',
            fieldName: 'dbPreset',
            document,
            variables,
            transform: (data) => ({
                dbPreset: data.dbPresets?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('DbPreset', 'createDbPreset', 'dbPreset', args.select, args.data, 'CreateDbPresetInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DbPreset',
            fieldName: 'createDbPreset',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('DbPreset', 'updateDbPreset', 'dbPreset', args.select, args.where.id, args.data, 'UpdateDbPresetInput', 'id', 'dbPresetPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DbPreset',
            fieldName: 'updateDbPreset',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('DbPreset', 'deleteDbPreset', 'dbPreset', {
            id: args.where.id,
        }, 'DeleteDbPresetInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DbPreset',
            fieldName: 'deleteDbPreset',
            document,
            variables,
        });
    }
}
