Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x 29x | // SPDX-FileCopyrightText: 2024-2026 Hack23 AB
// SPDX-License-Identifier: Apache-2.0
/**
* @module Types/Common
* @description Core shared types — language codes, article enums, and category mappings.
* These foundational types are used across all bounded contexts.
*/
import type { StakeholderPerspective, StakeholderOutcomeMatrix } from './stakeholder.js';
// re-export so consumers don't need a separate import
export type { StakeholderPerspective, StakeholderOutcomeMatrix } from './stakeholder.js';
/** Supported language codes */
export type LanguageCode =
| 'en'
| 'sv'
| 'da'
| 'no'
| 'fi'
| 'de'
| 'fr'
| 'es'
| 'nl'
| 'ar'
| 'he'
| 'ja'
| 'ko'
| 'zh';
/** RTL language codes */
export type RTLLanguageCode = 'ar' | 'he';
/** All possible language codes (including RTL) */
export type AnyLanguageCode = LanguageCode;
/**
* Article category — the primary classifier for content generation.
* Each value represents a distinct article type with its own data pipeline,
* template structure, and editorial voice.
*/
export enum ArticleCategory {
// Prospective — looking ahead
WEEK_AHEAD = 'week-ahead',
MONTH_AHEAD = 'month-ahead',
YEAR_AHEAD = 'year-ahead',
// Retrospective — looking back
WEEK_IN_REVIEW = 'week-in-review',
MONTH_IN_REVIEW = 'month-in-review',
YEAR_IN_REVIEW = 'year-in-review',
// Real-time
BREAKING_NEWS = 'breaking',
// Domain-specific
COMMITTEE_REPORTS = 'committee-reports',
MOTIONS = 'motions',
PROPOSITIONS = 'propositions',
// Analytical
DEEP_ANALYSIS = 'deep-analysis',
}
/**
* Temporal perspective of an article — derived from its category.
* Determines the editorial framing and verb tense.
*/
export enum ArticlePerspective {
/** Forward-looking: previews, agendas, upcoming events */
PROSPECTIVE = 'prospective',
/** Backward-looking: reviews, summaries, retrospectives */
RETROSPECTIVE = 'retrospective',
/** Live/current: breaking news, urgent developments */
REAL_TIME = 'real-time',
/** Deep dive: multi-perspective analysis, root cause */
ANALYTICAL = 'analytical',
}
/**
* Time period scope for periodic articles (look-ahead or in-review).
*/
export enum TimePeriod {
WEEK = 'week',
MONTH = 'month',
YEAR = 'year',
}
/**
* Analysis perspective for "5 Whys" deep analysis articles.
* Each perspective frames the same events through a different lens,
* asking "why" iteratively to uncover root causes.
*/
export enum AnalysisPerspective {
/** Party dynamics, power shifts, political strategy */
POLITICAL = 'political',
/** Budget impact, market effects, fiscal policy */
ECONOMIC = 'economic',
/** Citizen impact, public opinion, social equity */
SOCIAL = 'social',
/** Treaty basis, legal competence, compliance */
LEGAL = 'legal',
/** Climate, sustainability, green transition */
ENVIRONMENTAL = 'environmental',
/** EU external relations, global positioning */
GEOPOLITICAL = 'geopolitical',
/** EU institutional mechanics, inter-institutional balance */
INSTITUTIONAL = 'institutional',
}
/** Mapping from ArticleCategory to its inherent ArticlePerspective */
export const CATEGORY_PERSPECTIVE: Record<ArticleCategory, ArticlePerspective> = {
[ArticleCategory.WEEK_AHEAD]: ArticlePerspective.PROSPECTIVE,
[ArticleCategory.MONTH_AHEAD]: ArticlePerspective.PROSPECTIVE,
[ArticleCategory.YEAR_AHEAD]: ArticlePerspective.PROSPECTIVE,
[ArticleCategory.WEEK_IN_REVIEW]: ArticlePerspective.RETROSPECTIVE,
[ArticleCategory.MONTH_IN_REVIEW]: ArticlePerspective.RETROSPECTIVE,
[ArticleCategory.YEAR_IN_REVIEW]: ArticlePerspective.RETROSPECTIVE,
[ArticleCategory.BREAKING_NEWS]: ArticlePerspective.REAL_TIME,
[ArticleCategory.COMMITTEE_REPORTS]: ArticlePerspective.RETROSPECTIVE,
[ArticleCategory.MOTIONS]: ArticlePerspective.RETROSPECTIVE,
[ArticleCategory.PROPOSITIONS]: ArticlePerspective.PROSPECTIVE,
[ArticleCategory.DEEP_ANALYSIS]: ArticlePerspective.ANALYTICAL,
};
/** Mapping from periodic categories to their time period scope */
export const CATEGORY_TIME_PERIOD: Partial<Record<ArticleCategory, TimePeriod>> = {
[ArticleCategory.WEEK_AHEAD]: TimePeriod.WEEK,
[ArticleCategory.MONTH_AHEAD]: TimePeriod.MONTH,
[ArticleCategory.YEAR_AHEAD]: TimePeriod.YEAR,
[ArticleCategory.WEEK_IN_REVIEW]: TimePeriod.WEEK,
[ArticleCategory.MONTH_IN_REVIEW]: TimePeriod.MONTH,
[ArticleCategory.YEAR_IN_REVIEW]: TimePeriod.YEAR,
};
/** Language preset names */
export type LanguagePreset = 'all' | 'eu-core' | 'nordic';
/** Map from language code to translated string */
export type LanguageMap<T = string> = Record<LanguageCode, T>;
/** Article category labels for a single language — one entry per ArticleCategory */
export type ArticleCategoryLabels = Record<ArticleCategory, string>;
/** Language-specific title and subtitle */
export interface LangTitleSubtitle {
title: string;
subtitle: string;
}
/** Localized strings for propositions articles */
export interface PropositionsStrings {
lede: string;
proposalsHeading: string;
adoptedTextsHeading: string;
pipelineHeading: string;
procedureHeading: string;
analysisHeading: string;
analysis: string;
pipelineHealthLabel: string;
throughputRateLabel: string;
whyThisMatters: string;
}
/** Localized editorial strings shared across article types */
export interface EditorialStrings {
/** Heading for "Why This Matters" citizen-impact section */
whyThisMatters: string;
/** Heading for key analytical finding */
keyTakeaway: string;
/** Heading for parliamentary context section */
parliamentaryContext: string;
/** Source attribution phrase (e.g. "According to European Parliament records") */
sourceAttribution: string;
/** Analytical note label */
analysisNote: string;
}
/** Localized section heading strings for motions articles */
export interface MotionsStrings {
lede: string;
votingRecordsHeading: string;
partyCohesionHeading: string;
anomaliesHeading: string;
questionsHeading: string;
dateLabel: string;
resultLabel: string;
forLabel: string;
againstLabel: string;
abstainLabel: string;
cohesionLabel: string;
participationLabel: string;
severityLabel: string;
statusLabel: string;
keyTakeawayText: string;
politicalAlignmentHeading: string;
ledeAnalysis: string;
}
/** Localized section heading strings for week-ahead articles */
export interface WeekAheadStrings {
lede: string;
plenarySessions: string;
committeeMeetings: string;
legislativeDocuments: string;
legislativePipeline: string;
parliamentaryQuestions: string;
noPlenary: string;
bottleneckIndicator: string;
whatToWatch: string;
}
/** Localized section heading strings for breaking news articles */
export interface BreakingStrings {
breakingBanner: string;
votingAnomalyIntel: string;
coalitionDynamics: string;
analyticalReport: string;
keyMEPInfluence: string;
intelligenceBriefing: string;
votingAnomalyAlert: string;
coalitionDynamicsSection: string;
keyPlayers: string;
placeholderNotice: string;
placeholderLede: string;
lede: string;
/** Neutral feed-first lede used when analytical data is absent */
feedLede: string;
/** Section heading for recently adopted texts from EP feeds */
adoptedTextsHeading: string;
/** Section heading for recent EP events from feeds */
recentEventsHeading: string;
/** Section heading for legislative procedure updates from feeds */
procedureUpdatesHeading: string;
/** Section heading for MEP updates from feeds */
mepUpdatesHeading: string;
/** Label for the no-feed-data notice */
noFeedDataNotice: string;
/** Localized "as of" phrase used in lede section (e.g. "as of", "zum", "au") */
asOf: string;
/** Template function for "what happened" deep-analysis text */
breakingWhatFn: (
date: string,
adopted: number,
events: number,
procedures: number,
meps: number
) => string;
/** "Why it matters" text when voting anomalies are present */
breakingWhyAnomalies: string;
/** "Why it matters" text for normal parliamentary activity */
breakingWhyNormal: string;
/** Localized name for the legislative majority stakeholder */
breakingWinnerActor: string;
/** Template function for winner stakeholder reason */
breakingWinnerReasonFn: (count: number) => string;
/** Localized name for the opposition groups stakeholder */
breakingNeutralActor: string;
/** Neutral stakeholder reason text */
breakingNeutralReason: string;
/** Template function for active-legislative-phase outlook */
breakingOutlookActiveFn: (date: string) => string;
/** Template function for transitional-period outlook */
breakingOutlookTransitionalFn: (date: string) => string;
/** Consequence text for adopted texts ("New legal obligations…") */
breakingLegalObligationsConsequence: string;
/** Consequence text for procedure updates ("Legislative trajectory altered…") */
breakingProcedureConsequence: string;
/** Political impact text when voting anomalies are present */
breakingImpactPoliticalAnomalies: string;
/** Template function for political impact text in normal activity */
breakingImpactPoliticalNormalFn: (count: number) => string;
/** Economic impact text */
breakingImpactEconomic: string;
/** Social impact text */
breakingImpactSocial: string;
/** Template function for legal impact text */
breakingImpactLegalFn: (count: number) => string;
/** Geopolitical impact text when coalition data available */
breakingImpactGeopoliticalCoalition: string;
/** Geopolitical impact text for normal activity */
breakingImpactGeopoliticalNormal: string;
/** "Political group whips" mistake actor name */
breakingMistakeActor: string;
/** Mistake description text */
breakingMistakeDescription: string;
/** Mistake alternative text */
breakingMistakeAlternative: string;
/** Localized prefix for adopted text items in the "Who" list (e.g. "Adopted:", "Angenommen:") */
breakingAdoptedPrefix: string;
/** Localized prefix for MEP items in the "Who" list (e.g. "MEP:", "MdEP:") */
breakingMEPPrefix: string;
/** User-friendly fallback shown when voting anomaly data is unavailable */
anomalyUnavailable: string;
/** User-friendly fallback shown when coalition dynamics data is unavailable */
coalitionUnavailable: string;
/** Human-readable localized label for the adopted-text type (replaces raw "[TEXT_ADOPTED]" token) */
adoptedTextTypeLabel: string;
/** Template to format an adopted-text item title from its label/identifier (e.g. "T10-0315/2025") */
adoptedTextItemLabelFn: (label: string) => string;
/** Template to show truncation note: "Showing {shown} of {total}" */
showingXofNFn: (shown: number, total: number) => string;
}
// ─── Deep Analysis types ───────────────────────────────────────────────────
/**
* Single consequence resulting from a parliamentary action.
* Maps an action to its downstream political, economic, or social effects.
*/
export interface ActionConsequence {
/** The parliamentary action taken */
readonly action: string;
/** The resulting consequence or ripple effect */
readonly consequence: string;
/** How significant is this consequence: low, medium, high, critical */
readonly severity: 'low' | 'medium' | 'high' | 'critical';
}
/**
* Political stakeholder assessment: winners, losers, and their reasons.
*/
export interface StakeholderOutcome {
/** Name of stakeholder, political group, institution, or member state */
readonly actor: string;
/** Whether this actor benefits or is disadvantaged */
readonly outcome: 'winner' | 'loser' | 'neutral';
/** Explanation of why */
readonly reason: string;
}
/**
* A single identified mistake, miscalculation, or missed opportunity
* in parliamentary proceedings.
*/
export interface PoliticalMistake {
/** Who made the mistake */
readonly actor: string;
/** What the mistake or miscalculation was */
readonly description: string;
/** What they should have done differently */
readonly alternative: string;
}
/**
* Comprehensive deep political analysis using the "5W + Impact" framework.
* Every article type populates this from its available data to provide
* parliament-intelligence-grade analysis for sophisticated readers.
*
* Fields map to the framework:
* - **What**: What happened / what is proposed
* - **Who**: Key actors, political groups, rapporteurs, shadows
* - **When**: Timeline, deadlines, key dates
* - **Why**: Root causes, political motivations, strategic calculations
* - **Winners/Losers**: Who benefits, who loses, stakeholder impact
* - **Impact**: Multi-perspective consequences (political, economic, social, legal)
* - **Actions → Consequences**: Causal chains from decisions to outcomes
* - **Mistakes**: Miscalculations, missed opportunities
* - **Outlook**: What happens next, strategic implications
* - **Stakeholder Perspectives**: Multi-stakeholder impact assessment per group
* - **Stakeholder Outcome Matrix**: Winner/loser/neutral matrix per action per group
*/
export interface DeepAnalysis {
/** WHAT: Core subject — what happened or is being proposed */
readonly what: string;
/** WHO: Key actors — political groups, rapporteurs, MEPs, institutions */
readonly who: readonly string[];
/** WHEN: Key dates — timeline, deadlines, procedural milestones */
readonly when: readonly string[];
/** WHY: Root causes — political motivations, strategic calculations */
readonly why: string;
/** WINNERS & LOSERS: Stakeholder impact assessment */
readonly stakeholderOutcomes: readonly StakeholderOutcome[];
/** IMPACT: Multi-perspective analysis of consequences */
readonly impactAssessment: {
readonly political: string;
readonly economic: string;
readonly social: string;
readonly legal: string;
readonly geopolitical: string;
};
/** ACTIONS → CONSEQUENCES: Causal chains */
readonly actionConsequences: readonly ActionConsequence[];
/** MISTAKES: Miscalculations and missed opportunities */
readonly mistakes: readonly PoliticalMistake[];
/** OUTLOOK: What happens next — strategic forward look */
readonly outlook: string;
/**
* MULTI-STAKEHOLDER PERSPECTIVES: Detailed impact per stakeholder group.
* Optional — populated by enhanced analysis builders.
*/
readonly stakeholderPerspectives?: readonly StakeholderPerspective[];
/**
* STAKEHOLDER OUTCOME MATRIX: Winner/loser/neutral per action per group.
* Optional — populated by enhanced analysis builders.
*/
readonly stakeholderOutcomeMatrix?: readonly StakeholderOutcomeMatrix[];
}
/** Localized strings for deep analysis section headings */
export interface DeepAnalysisStrings {
/** Main section heading */
readonly sectionHeading: string;
/** Sub-heading for "What" */
readonly whatHeading: string;
/** Sub-heading for "Who" */
readonly whoHeading: string;
/** Sub-heading for "When" */
readonly whenHeading: string;
/** Sub-heading for "Why" */
readonly whyHeading: string;
/** Sub-heading for Winners & Losers */
readonly stakeholderHeading: string;
/** Label for winner outcome */
readonly winnerLabel: string;
/** Label for loser outcome */
readonly loserLabel: string;
/** Label for neutral outcome */
readonly neutralLabel: string;
/** Sub-heading for impact assessment */
readonly impactHeading: string;
/** Impact perspective labels */
readonly politicalLabel: string;
readonly economicLabel: string;
readonly socialLabel: string;
readonly legalLabel: string;
readonly geopoliticalLabel: string;
/** Sub-heading for actions → consequences */
readonly consequencesHeading: string;
/** Label for action column */
readonly actionLabel: string;
/** Label for consequence column */
readonly consequenceLabel: string;
/** Label for severity column header */
readonly severityColumnLabel: string;
/** Sub-heading for mistakes */
readonly mistakesHeading: string;
/** Label for "should have" alternative */
readonly alternativeLabel: string;
/** Sub-heading for outlook */
readonly outlookHeading: string;
/** Severity labels */
readonly severityLow: string;
readonly severityMedium: string;
readonly severityHigh: string;
readonly severityCritical: string;
/** Sub-heading for multi-stakeholder perspectives section */
readonly perspectivesHeading: string;
/** Sub-heading for stakeholder outcome matrix section */
readonly outcomeMatrixHeading: string;
/** Column header for "Confidence" in the outcome matrix */
readonly confidenceLabel: string;
/** Localized stakeholder group labels for the outcome matrix columns */
readonly politicalGroupsLabel: string;
readonly civilSocietyLabel: string;
readonly industryLabel: string;
readonly nationalGovtsLabel: string;
readonly citizensLabel: string;
readonly euInstitutionsLabel: string;
/** Impact direction labels for stakeholder perspective cards */
readonly positiveLabel: string;
readonly negativeLabel: string;
readonly mixedLabel: string;
// ─── Enhanced analysis strings ───────────────────────────────────────────
/** Heading for executive summary section */
readonly executiveSummaryHeading: string;
/** Confidence level labels */
readonly confidenceHigh: string;
readonly confidenceMedium: string;
readonly confidenceLow: string;
/** Evidence references heading */
readonly evidenceRefsHeading: string;
/** Counter-arguments heading */
readonly counterArgumentsHeading: string;
/** Section labels for reasoning chains */
readonly conclusionLabel: string;
readonly premiseLabel: string;
readonly inferenceLabel: string;
/** Heading for reasoning chains section */
readonly reasoningChainsHeading: string;
/** Heading for scenario planning section */
readonly scenarioPlanningHeading: string;
/** Scenario labels */
readonly bestCaseLabel: string;
readonly worstCaseLabel: string;
readonly mostLikelyLabel: string;
readonly wildcardsLabel: string;
readonly probabilityLabel: string;
readonly triggersLabel: string;
readonly impliedImpactsLabel: string;
readonly timelineLabel: string;
/** Heading for analysis methodology section */
readonly analysisMethodologyHeading: string;
/** Methodology metadata labels */
readonly iterationCountLabel: string;
readonly evidenceStrengthLabel: string;
/** Evidence strength values */
readonly evidenceStrong: string;
readonly evidenceModerate: string;
readonly evidenceWeak: string;
/** Iteration type labels */
readonly iterationInitial: string;
readonly iterationStakeholderChallenge: string;
readonly iterationEvidenceValidation: string;
readonly iterationSynthesis: string;
/** Label for overall confidence in methodology stats */
readonly overallConfidenceLabel: string;
}
/** Localized content strings for the committee analysis deep analysis body text */
export interface CommitteeAnalysisContentStrings {
/** Template: what happened. {date}, {total}, {docs}, {active} placeholders */
readonly what: string;
/** Template: what happened when no documents are available. {date}, {total} placeholders */
readonly whatNoData: string;
/** "Reporting date:" label prefix */
readonly reportDateLabel: string;
/** "members" label */
readonly membersLabel: string;
/** "Chair:" label */
readonly chairLabel: string;
/** "robust" productivity descriptor */
readonly productivityRobust: string;
/** "moderate" productivity descriptor */
readonly productivityModerate: string;
/** "low" productivity descriptor used when 0% of committees have recent documents */
readonly productivityLow: string;
/** Why section text. {pct}, {descriptor} placeholders */
readonly why: string;
/** Impact political text when no committees are active. */
readonly impactPoliticalNone: string;
/** Stakeholder reason: highly productive. {n} placeholder */
readonly stakeholderHighlyProductive: string;
/** Stakeholder reason: moderate activity. {n} placeholder */
readonly stakeholderModerateActivity: string;
/** Stakeholder reason: no documents */
readonly stakeholderNoDocs: string;
/** Impact political text. {active}, {total} placeholders */
readonly impactPolitical: string;
/** Impact economic text */
readonly impactEconomic: string;
/** Impact social text */
readonly impactSocial: string;
/** Impact legal text. {docs} placeholder */
readonly impactLegal: string;
/** Impact geopolitical text */
readonly impactGeopolitical: string;
/** Action label. {abbr}, {n} placeholders */
readonly actionProcessed: string;
/** Consequence text */
readonly actionConsequence: string;
/** Mistake description */
readonly mistakeDescription: string;
/** Mistake alternative */
readonly mistakeAlternative: string;
/** Outlook when pipeline is healthy. {n}, {total} placeholders */
readonly outlookGood: string;
/** Outlook when pipeline has concerns */
readonly outlookConcern: string;
/** Lede paragraph for the committee-reports article overview */
readonly lede: string;
/** "No recent documents available" fallback list item */
readonly noRecentDocs: string;
/** Notice shown in committee cards when all committee metadata is unavailable from the EP API */
readonly committeeMetadataUnavailable: string;
/** Section heading for the adopted texts overview in feed-enriched articles */
readonly adoptedTextsSectionHeading: string;
/** Summary paragraph for adopted texts section (plural). {count} placeholder is replaced with the number of texts */
readonly adoptedTextsSummary: string;
/** Summary paragraph for adopted texts section when exactly one text was adopted (singular form) */
readonly adoptedTextsSummarySingular: string;
/** Full name of the ENVI committee */
readonly committeeNameENVI: string;
/** Full name of the ECON committee */
readonly committeeNameECON: string;
/** Full name of the AFET committee */
readonly committeeNameAFET: string;
/** Full name of the LIBE committee */
readonly committeeNameLIBE: string;
/** Full name of the AGRI committee */
readonly committeeNameAGRI: string;
/** Label for texts not fitting the named committee themes */
readonly committeeNameOTHER: string;
}
|