import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformConfigModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformConfig', 'platformConfigs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformConfigFilter', 'PlatformConfigOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformConfig',
            fieldName: 'platformConfigs',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformConfig', 'platformConfigs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformConfigFilter', 'PlatformConfigOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformConfig',
            fieldName: 'platformConfig',
            document,
            variables,
            transform: (data) => ({
                platformConfig: data.platformConfigs?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformConfig', 'platformConfigs', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformConfigFilter', 'PlatformConfigOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformConfig',
            fieldName: 'platformConfig',
            document,
            variables,
            transform: (data) => ({
                platformConfig: data.platformConfigs?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformConfig', 'createPlatformConfig', 'platformConfig', args.select, args.data, 'CreatePlatformConfigInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformConfig',
            fieldName: 'createPlatformConfig',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformConfig', 'updatePlatformConfig', 'platformConfig', args.select, args.where.id, args.data, 'UpdatePlatformConfigInput', 'id', 'platformConfigPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformConfig',
            fieldName: 'updatePlatformConfig',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformConfig', 'deletePlatformConfig', 'platformConfig', {
            id: args.where.id,
        }, 'DeletePlatformConfigInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformConfig',
            fieldName: 'deletePlatformConfig',
            document,
            variables,
        });
    }
}
