import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class SecretDefinitionModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('SecretDefinition', 'secretDefinitions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'SecretDefinitionFilter', 'SecretDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SecretDefinition',
            fieldName: 'secretDefinitions',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('SecretDefinition', 'secretDefinitions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'SecretDefinitionFilter', 'SecretDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SecretDefinition',
            fieldName: 'secretDefinition',
            document,
            variables,
            transform: (data) => ({
                secretDefinition: data.secretDefinitions?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('SecretDefinition', 'secretDefinitions', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'SecretDefinitionFilter', 'SecretDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SecretDefinition',
            fieldName: 'secretDefinition',
            document,
            variables,
            transform: (data) => ({
                secretDefinition: data.secretDefinitions?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('SecretDefinition', 'createSecretDefinition', 'secretDefinition', args.select, args.data, 'CreateSecretDefinitionInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SecretDefinition',
            fieldName: 'createSecretDefinition',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('SecretDefinition', 'updateSecretDefinition', 'secretDefinition', args.select, args.where.id, args.data, 'UpdateSecretDefinitionInput', 'id', 'secretDefinitionPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SecretDefinition',
            fieldName: 'updateSecretDefinition',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('SecretDefinition', 'deleteSecretDefinition', 'secretDefinition', {
            id: args.where.id,
        }, 'DeleteSecretDefinitionInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SecretDefinition',
            fieldName: 'deleteSecretDefinition',
            document,
            variables,
        });
    }
}
