import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class ConfigSecretsOrgModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('ConfigSecretsOrgModule', 'configSecretsOrgModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'ConfigSecretsOrgModuleFilter', 'ConfigSecretsOrgModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConfigSecretsOrgModule',
            fieldName: 'configSecretsOrgModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('ConfigSecretsOrgModule', 'configSecretsOrgModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'ConfigSecretsOrgModuleFilter', 'ConfigSecretsOrgModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConfigSecretsOrgModule',
            fieldName: 'configSecretsOrgModule',
            document,
            variables,
            transform: (data) => ({
                configSecretsOrgModule: data.configSecretsOrgModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('ConfigSecretsOrgModule', 'configSecretsOrgModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'ConfigSecretsOrgModuleFilter', 'ConfigSecretsOrgModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConfigSecretsOrgModule',
            fieldName: 'configSecretsOrgModule',
            document,
            variables,
            transform: (data) => ({
                configSecretsOrgModule: data.configSecretsOrgModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('ConfigSecretsOrgModule', 'createConfigSecretsOrgModule', 'configSecretsOrgModule', args.select, args.data, 'CreateConfigSecretsOrgModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConfigSecretsOrgModule',
            fieldName: 'createConfigSecretsOrgModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('ConfigSecretsOrgModule', 'updateConfigSecretsOrgModule', 'configSecretsOrgModule', args.select, args.where.id, args.data, 'UpdateConfigSecretsOrgModuleInput', 'id', 'configSecretsOrgModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConfigSecretsOrgModule',
            fieldName: 'updateConfigSecretsOrgModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('ConfigSecretsOrgModule', 'deleteConfigSecretsOrgModule', 'configSecretsOrgModule', {
            id: args.where.id,
        }, 'DeleteConfigSecretsOrgModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConfigSecretsOrgModule',
            fieldName: 'deleteConfigSecretsOrgModule',
            document,
            variables,
        });
    }
}
