import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformFunctionDefinitionModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformFunctionDefinition', 'platformFunctionDefinitions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformFunctionDefinitionFilter', 'PlatformFunctionDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformFunctionDefinition',
            fieldName: 'platformFunctionDefinitions',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformFunctionDefinition', 'platformFunctionDefinitions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformFunctionDefinitionFilter', 'PlatformFunctionDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformFunctionDefinition',
            fieldName: 'platformFunctionDefinition',
            document,
            variables,
            transform: (data) => ({
                platformFunctionDefinition: data.platformFunctionDefinitions?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformFunctionDefinition', 'platformFunctionDefinitions', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformFunctionDefinitionFilter', 'PlatformFunctionDefinitionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformFunctionDefinition',
            fieldName: 'platformFunctionDefinition',
            document,
            variables,
            transform: (data) => ({
                platformFunctionDefinition: data.platformFunctionDefinitions?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformFunctionDefinition', 'createPlatformFunctionDefinition', 'platformFunctionDefinition', args.select, args.data, 'CreatePlatformFunctionDefinitionInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformFunctionDefinition',
            fieldName: 'createPlatformFunctionDefinition',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformFunctionDefinition', 'updatePlatformFunctionDefinition', 'platformFunctionDefinition', args.select, args.where.id, args.data, 'UpdatePlatformFunctionDefinitionInput', 'id', 'platformFunctionDefinitionPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformFunctionDefinition',
            fieldName: 'updatePlatformFunctionDefinition',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformFunctionDefinition', 'deletePlatformFunctionDefinition', 'platformFunctionDefinition', {
            id: args.where.id,
        }, 'DeletePlatformFunctionDefinitionInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformFunctionDefinition',
            fieldName: 'deletePlatformFunctionDefinition',
            document,
            variables,
        });
    }
}
