import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class DevicesModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('DevicesModule', 'devicesModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'DevicesModuleFilter', 'DevicesModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DevicesModule',
            fieldName: 'devicesModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('DevicesModule', 'devicesModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'DevicesModuleFilter', 'DevicesModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DevicesModule',
            fieldName: 'devicesModule',
            document,
            variables,
            transform: (data) => ({
                devicesModule: data.devicesModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('DevicesModule', 'devicesModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'DevicesModuleFilter', 'DevicesModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DevicesModule',
            fieldName: 'devicesModule',
            document,
            variables,
            transform: (data) => ({
                devicesModule: data.devicesModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('DevicesModule', 'createDevicesModule', 'devicesModule', args.select, args.data, 'CreateDevicesModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DevicesModule',
            fieldName: 'createDevicesModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('DevicesModule', 'updateDevicesModule', 'devicesModule', args.select, args.where.id, args.data, 'UpdateDevicesModuleInput', 'id', 'devicesModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DevicesModule',
            fieldName: 'updateDevicesModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('DevicesModule', 'deleteDevicesModule', 'devicesModule', {
            id: args.where.id,
        }, 'DeleteDevicesModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DevicesModule',
            fieldName: 'deleteDevicesModule',
            document,
            variables,
        });
    }
}
