import { ComponentInputType, } from "../../../Types/Dashboard/DashboardComponents/ComponentArgument";
import { DashboardValueTrendDirection, } from "../../../Types/Dashboard/DashboardComponents/DashboardValueComponent";
import DashboardComponentType from "../../../Types/Dashboard/DashboardComponentType";
import { ObjectType } from "../../../Types/JSON";
import ObjectID from "../../../Types/ObjectID";
import DashboardBaseComponentUtil from "./DashboardBaseComponent";
const DataSourceSection = {
    name: "Data Source",
    description: "Configure which metric to display",
    order: 1,
};
const DisplaySection = {
    name: "Display",
    description: "Tune how the trend arrow is coloured",
    order: 2,
    defaultCollapsed: true,
};
const ThresholdsSection = {
    name: "Thresholds",
    description: "Set warning and critical levels",
    order: 3,
    defaultCollapsed: true,
};
export default class DashboardValueComponentUtil extends DashboardBaseComponentUtil {
    static getDefaultComponent() {
        return {
            _type: ObjectType.DashboardComponent,
            componentType: DashboardComponentType.Value,
            widthInDashboardUnits: 3,
            heightInDashboardUnits: 1,
            topInDashboardUnits: 0,
            leftInDashboardUnits: 0,
            componentId: ObjectID.generate(),
            minHeightInDashboardUnits: 1,
            minWidthInDashboardUnits: 1,
            arguments: {
                title: "",
                metricQueryConfig: {
                    metricQueryData: {
                        filterData: {},
                        groupBy: undefined,
                    },
                },
            },
        };
    }
    static getComponentConfigArguments() {
        const componentArguments = [];
        componentArguments.push({
            name: "Title",
            description: "Label shown above the value",
            required: false,
            type: ComponentInputType.Text,
            id: "title",
            section: DataSourceSection,
        });
        componentArguments.push({
            name: "Metric Query",
            description: "Select the metric to display as a value",
            required: true,
            type: ComponentInputType.MetricsQueryConfig,
            id: "metricQueryConfig",
            section: DataSourceSection,
        });
        componentArguments.push({
            name: "Trend Direction",
            description: "How the trend arrow is coloured. Auto reads the metric name (e.g. 'error_count' and 'latency' are treated as 'higher is worse'). Pick a value to override.",
            required: false,
            type: ComponentInputType.Dropdown,
            id: "trendDirection",
            isAdvanced: true,
            section: DisplaySection,
            dropdownOptions: [
                {
                    label: "Auto (detect from metric name)",
                    value: DashboardValueTrendDirection.Auto,
                },
                {
                    label: "Higher is better (↑ green)",
                    value: DashboardValueTrendDirection.HigherIsBetter,
                },
                {
                    label: "Higher is worse (↑ red)",
                    value: DashboardValueTrendDirection.HigherIsWorse,
                },
            ],
        });
        componentArguments.push({
            name: "Warning Threshold",
            description: "Yellow background when value exceeds this",
            required: false,
            type: ComponentInputType.Number,
            id: "warningThreshold",
            isAdvanced: true,
            section: ThresholdsSection,
        });
        componentArguments.push({
            name: "Critical Threshold",
            description: "Red background when value exceeds this",
            required: false,
            type: ComponentInputType.Number,
            id: "criticalThreshold",
            isAdvanced: true,
            section: ThresholdsSection,
        });
        return componentArguments;
    }
}
//# sourceMappingURL=DashboardValueComponent.js.map