import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformConfigDefinitionModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformConfigDefinition', 'platformConfigDefinitions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformConfigDefinitionFilter', 'PlatformConfigDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformConfigDefinition',
            fieldName: 'platformConfigDefinitions',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformConfigDefinition', 'platformConfigDefinitions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformConfigDefinitionFilter', 'PlatformConfigDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformConfigDefinition',
            fieldName: 'platformConfigDefinition',
            document,
            variables,
            transform: (data) => ({
                platformConfigDefinition: data.platformConfigDefinitions?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformConfigDefinition', 'platformConfigDefinitions', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformConfigDefinitionFilter', 'PlatformConfigDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformConfigDefinition',
            fieldName: 'platformConfigDefinition',
            document,
            variables,
            transform: (data) => ({
                platformConfigDefinition: data.platformConfigDefinitions?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformConfigDefinition', 'createPlatformConfigDefinition', 'platformConfigDefinition', args.select, args.data, 'CreatePlatformConfigDefinitionInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformConfigDefinition',
            fieldName: 'createPlatformConfigDefinition',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformConfigDefinition', 'updatePlatformConfigDefinition', 'platformConfigDefinition', args.select, args.where.id, args.data, 'UpdatePlatformConfigDefinitionInput', 'id', 'platformConfigDefinitionPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformConfigDefinition',
            fieldName: 'updatePlatformConfigDefinition',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformConfigDefinition', 'deletePlatformConfigDefinition', 'platformConfigDefinition', {
            id: args.where.id,
        }, 'DeletePlatformConfigDefinitionInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformConfigDefinition',
            fieldName: 'deletePlatformConfigDefinition',
            document,
            variables,
        });
    }
}
