/** * Types for a service's requirements on a lane (GET /services/{slug}/{origin}/{destination}/requirements). */ export type RequirementCompare = 'Eq' | 'NotEq' | 'Gt' | 'Gte' | 'Lt' | 'Lte'; /** A rule's `requiredIf`: a field comparison and/or `all` / `any` groups of further conditions. */ export interface RequirementCondition { field?: string; value?: string | number | null | Array< string | number | null >; compare?: RequirementCompare; all?: RequirementCondition[]; any?: RequirementCondition[]; } export interface RuleMetadata { /** The parcel value above which the field is not offered (minor units). */ maxParcelValue?: number; requiredIf?: RequirementCondition; [ key: string ]: unknown; } export interface Rule { key: string; name?: string; required: boolean; valueType?: string; metadata?: RuleMetadata; } export interface RuleSet { key?: string; displayName?: string; required?: boolean; metadata?: Record< string, unknown >; rules: Rule[]; } export type RuleSets = Record< string, RuleSet >; export interface ServiceRequirements { ruleSets: RuleSets; metadata: Record< string, unknown >; }