import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class AppLevelModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('AppLevel', 'appLevels', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'AppLevelFilter', 'AppLevelOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLevel',
            fieldName: 'appLevels',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('AppLevel', 'appLevels', args.select, {
            where: args?.where,
        }, 'AppLevelFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLevel',
            fieldName: 'appLevels',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('AppLevel', 'appLevels', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AppLevelFilter', 'AppLevelOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLevel',
            fieldName: 'appLevel',
            document,
            variables,
            transform: (data) => ({
                appLevel: data.appLevels?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('AppLevel', 'createAppLevel', 'appLevel', args.select, args.data, 'CreateAppLevelInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLevel',
            fieldName: 'createAppLevel',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('AppLevel', 'updateAppLevel', 'appLevel', args.select, args.where.id, args.data, 'UpdateAppLevelInput', 'id', 'appLevelPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLevel',
            fieldName: 'updateAppLevel',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('AppLevel', 'deleteAppLevel', 'appLevel', {
            id: args.where.id,
        }, 'DeleteAppLevelInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLevel',
            fieldName: 'deleteAppLevel',
            document,
            variables,
        });
    }
}
