import { ComponentDescriptor } from '../core'; import { PropertyType } from '../limetype'; /** * A label/value property a provider contributes to the problem detail * dialog's metadata section, rendered by the platform alongside its standard * properties (severity, status, created). * * When `type` is omitted the value is rendered as plain text and should be a * pre-formatted display string. When `type` is set, the platform formats the * raw value (e.g. a `'time'` property takes a raw ISO date string and renders * it as a localized date), so pass the raw value, not a pre-formatted one. * * @example A typed property, where the platform formats the value * ```ts * import { ProblemMetadataProperty } from '@limetech/lime-web-components'; * * // `type` is set, so the platform formats the value. Pass the raw ISO string. * const property: ProblemMetadataProperty = { * label: 'Email date', * value: '2026-06-17T23:52:00Z', * type: 'time', * }; * ``` * * @alpha * @group Problem */ export interface ProblemMetadataProperty { /** * Human-readable label for the property (e.g. 'Email date'). */ label: string; /** * The property value. A pre-formatted display string when `type` is * omitted, or the raw value (e.g. an ISO date string) when `type` is set. */ value: string; /** * Optional data type controlling how the value is rendered. When omitted, * the value is rendered as plain text. * * @see {@link PropertyType} */ type?: PropertyType; } /** * A single entry a provider contributes to the problem detail dialog's * metadata section via {@link ProblemProvider.getMetadata}. * * Both arms render in the metadata section; the only difference is who owns * the rendered component: * * - **built-in** (no `name`): the platform renders the * {@link ProblemMetadataProperty} in `props` as a standard label/value * property. * - **custom** (`name` set): a {@link ComponentDescriptor} for a component the * provider owns; the platform instantiates it and sets its `props`. * * Because a provider returns an ordered array of these, built-in properties * and custom components can be mixed and ordered freely. Custom-component * entries may carry `rules` to gate their visibility; built-in properties are * always rendered (the platform renders them as flat cells, which have no * per-cell visibility gating — express a gated value as a component instead). * * @alpha * @group Problem */ export type ProblemMetadataEntry = ComponentDescriptor | { name?: never; props: ProblemMetadataProperty; };