import type { WorkflowStatus } from '../../api/adaptive/adaptiveWorkflow.types';
import type { IconName } from '../../components/ui/atoms/Icon/Icon';
import type { NsTranslationKey } from '../../../types';
import type { ComponentName } from '../component-registry';
/**
 * Config for a task group received from the adaptive workflow engine.
 * @param id used to map a particular task group to FE-specific contexual details (ex. copy) from a task group context map
 * @param tasks tasks which are associated with this task group
 */
export interface TaskGroupConfig {
    id: string;
    tasks: TaskConfig[];
}
/**
 * Config for an individual task within a task group.
 * @param id used to map a task to contextual details from a task context map
 * @param status status of a task item (current we may assume all fields returned from RE to AWE will be `INCOMPLETE`, may not be necessary)
 * @param steps if present, indicates a dynamically parsed and rendered form {@link DynamicForm} is shown inside a modal.
 * @param component if present, this indicates a single specialized component is rendered instead of a dynamic form.
 * @param subTasks if present, indicates there are nested task items.
 */
export interface TaskConfig {
    id: string;
    steps?: StepConfig[];
    component?: ComponentConfig;
    subTasks?: TaskConfig[];
}
/**
 * Config for a single step (i.e. one page) within a dynamically rendered form
 */
export interface StepConfig {
    /** Unique step identifier, used as the React key and displayed as the step heading. */
    id: string;
    /** Ordered list of component groups rendered within this step. */
    componentGroups: ComponentGroupConfig[];
}
/**
 * Config for grouping of components within a dynamic form step
 * Used to associate groups of components with copy or within a specific component (ex. grouping several fields within an accordion or other wrapping UI element)
 * @param id used for mapping to context
 * @param components nested child components part of the component group
 */
export interface ComponentGroupConfig {
    id: string;
    components: ComponentConfig[];
}
/**
 * AWE returns props per component
 * @param type indicates whether a prop contains a value to be used by component directly (type === 'value'), or if the prop maps to a value returned as part of AWE globals object (type === 'global')
 * @param value the path to get prop value from globals (if type === 'global') or the value to be used in component directly (type === 'value')
 */
export type PropValue = {
    type: 'global';
    value: string;
} | {
    type: 'value';
    value: unknown;
};
/**
 * Config for an individual UI component.
 * @param id used for context mapping
 * @param componentName name of component to map to in component registry
 * @param componentType determines how the component is rendered:
 * - `field` — a simple form field wrapped in a single `form.Field` and mapped to a single data point.
 * - `compound` — a compound component that links several related fields (ex. data points nested in one object) associated with one base requirement path.
 * - `specialized` — a self-contained component handling its own rendering, form steps, and submission.
 * @param path path to a data point as returned from requirements engine, which will be used for data submission
 * @param value value of a field
 * @param props props passed into rendered components
 */
export interface ComponentConfig {
    id: string;
    componentName: ComponentName;
    componentType: 'field' | 'compound' | 'specialized';
    path: string;
    status: WorkflowStatus;
    value?: unknown;
    props?: Record<string, PropValue> & Partial<ReservedProps>;
}
export type ReservedProps = {
    resourceId: {
        type: 'value' | 'global';
        value: string;
    };
};
/**
 * UI context for a task group, mapped from the TaskGroup context map.
 */
export interface TaskGroupContext {
    heading: NsTranslationKey<'adaptive'>;
    description: NsTranslationKey<'adaptive'>;
}
/**
 * UI context for a task, mapped from the Task context map.
 */
export interface TaskContext {
    title: NsTranslationKey<'adaptive'>;
    icon: IconName;
}
/**
 * UI context for a step, mapped from the Step context map.
 */
export interface StepContext {
    heading: NsTranslationKey<'adaptive'>;
    description: NsTranslationKey<'adaptive'>;
}
