import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class InternalSecretsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('InternalSecretsModule', 'internalSecretsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'InternalSecretsModuleFilter', 'InternalSecretsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InternalSecretsModule',
            fieldName: 'internalSecretsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('InternalSecretsModule', 'internalSecretsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'InternalSecretsModuleFilter', 'InternalSecretsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InternalSecretsModule',
            fieldName: 'internalSecretsModule',
            document,
            variables,
            transform: (data) => ({
                internalSecretsModule: data.internalSecretsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('InternalSecretsModule', 'internalSecretsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'InternalSecretsModuleFilter', 'InternalSecretsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InternalSecretsModule',
            fieldName: 'internalSecretsModule',
            document,
            variables,
            transform: (data) => ({
                internalSecretsModule: data.internalSecretsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('InternalSecretsModule', 'createInternalSecretsModule', 'internalSecretsModule', args.select, args.data, 'CreateInternalSecretsModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InternalSecretsModule',
            fieldName: 'createInternalSecretsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('InternalSecretsModule', 'updateInternalSecretsModule', 'internalSecretsModule', args.select, args.where.id, args.data, 'UpdateInternalSecretsModuleInput', 'id', 'internalSecretsModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InternalSecretsModule',
            fieldName: 'updateInternalSecretsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('InternalSecretsModule', 'deleteInternalSecretsModule', 'internalSecretsModule', {
            id: args.where.id,
        }, 'DeleteInternalSecretsModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InternalSecretsModule',
            fieldName: 'deleteInternalSecretsModule',
            document,
            variables,
        });
    }
}
