"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlatformResourceUsageSummaryModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class PlatformResourceUsageSummaryModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('PlatformResourceUsageSummary', 'platformResourceUsageSummaries', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformResourceUsageSummaryFilter', 'PlatformResourceUsageSummaryOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'platformResourceUsageSummaries',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('PlatformResourceUsageSummary', 'platformResourceUsageSummaries', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformResourceUsageSummaryFilter', 'PlatformResourceUsageSummaryOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'platformResourceUsageSummary',
            document,
            variables,
            transform: (data) => ({
                platformResourceUsageSummary: data.platformResourceUsageSummaries?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('PlatformResourceUsageSummary', 'platformResourceUsageSummaries', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformResourceUsageSummaryFilter', 'PlatformResourceUsageSummaryOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'platformResourceUsageSummary',
            document,
            variables,
            transform: (data) => ({
                platformResourceUsageSummary: data.platformResourceUsageSummaries?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('PlatformResourceUsageSummary', 'createPlatformResourceUsageSummary', 'platformResourceUsageSummary', args.select, args.data, 'CreatePlatformResourceUsageSummaryInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'createPlatformResourceUsageSummary',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('PlatformResourceUsageSummary', 'updatePlatformResourceUsageSummary', 'platformResourceUsageSummary', args.select, args.where.id, args.data, 'UpdatePlatformResourceUsageSummaryInput', 'id', 'platformResourceUsageSummaryPatch', input_types_1.connectionFieldsMap, {
            date: args.where.date,
        });
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'updatePlatformResourceUsageSummary',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('PlatformResourceUsageSummary', 'deletePlatformResourceUsageSummary', 'platformResourceUsageSummary', {
            id: args.where.id,
            date: args.where.date,
        }, 'DeletePlatformResourceUsageSummaryInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'deletePlatformResourceUsageSummary',
            document,
            variables,
        });
    }
}
exports.PlatformResourceUsageSummaryModel = PlatformResourceUsageSummaryModel;
