mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 11:45:23 +02:00
127 lines
3.1 KiB
TypeScript
127 lines
3.1 KiB
TypeScript
|
|||
|
|
|
||
|
|
export interface SalesRecord {
|
||
|
|
id: string;
|
||
|
|
customer: string;
|
||
|
|
year: number;
|
||
|
|
month: string; // "Apr-23"
|
||
|
|
week?: number;
|
||
|
|
asin: string;
|
||
|
|
sku: string;
|
||
|
|
title: string; // Added Product Title
|
||
|
|
articleName: string; // Kept for backward compatibility if mixed files used
|
||
|
|
units: number;
|
||
|
|
sellOut: number; // Parsed numeric value
|
||
|
|
line: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface FilterState {
|
||
|
|
customer: string[];
|
||
|
|
year: string[];
|
||
|
|
month: string[];
|
||
|
|
line: string[];
|
||
|
|
asin: string[];
|
||
|
|
sku: string[];
|
||
|
|
title: string[]; // Added Title filter
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface LineGrowthMetric { // Renamed from GrowthMetric
|
||
|
|
line: string;
|
||
|
|
currentYearSellOut: number;
|
||
|
|
previousYearSellOut: number;
|
||
|
|
sellOutGrowthValue: number;
|
||
|
|
sellOutGrowthPercentage: number;
|
||
|
|
|
||
|
|
currentYearUnits: number;
|
||
|
|
previousYearUnits: number;
|
||
|
|
unitsGrowthValue: number;
|
||
|
|
unitsGrowthPercentage: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ItemGrowthMetric {
|
||
|
|
sku: string;
|
||
|
|
asin: string;
|
||
|
|
title: string;
|
||
|
|
line: string; // Keep line for context
|
||
|
|
currentYearSellOut: number;
|
||
|
|
previousYearSellOut: number;
|
||
|
|
sellOutGrowthValue: number;
|
||
|
|
sellOutGrowthPercentage: number;
|
||
|
|
|
||
|
|
currentYearUnits: number;
|
||
|
|
previousYearUnits: number;
|
||
|
|
unitsGrowthValue: number;
|
||
|
|
unitsGrowthPercentage: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
export interface SeasonalityPoint {
|
||
|
|
name: string; // "Jan", "Feb", etc.
|
||
|
|
[year: string]: number | string; // Dynamic keys for years: "2023": 500, "2024": 600
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface YearlySplitData {
|
||
|
|
name: string;
|
||
|
|
// Dynamic keys like "2023", "2024" or "2023_value", "2023_units"
|
||
|
|
[key: string]: number | string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface AggregatedData {
|
||
|
|
totalSellOut: number;
|
||
|
|
totalUnits: number;
|
||
|
|
totalsByYear: Record<string, { sellOut: number; units: number }>;
|
||
|
|
byLine: { name: string; value: number; units: number }[];
|
||
|
|
byCustomer: { name: string; value: number }[];
|
||
|
|
seasonality: SeasonalityPoint[];
|
||
|
|
seasonalityUnits: SeasonalityPoint[];
|
||
|
|
availableYears: string[];
|
||
|
|
topMovers: LineGrowthMetric[]; // Now uses LineGrowthMetric
|
||
|
|
bottomMovers: LineGrowthMetric[]; // Now uses LineGrowthMetric
|
||
|
|
comparisonPeriods: { current: string; previous: string };
|
||
|
|
topLinesSplit: YearlySplitData[];
|
||
|
|
byCustomerSplit: YearlySplitData[];
|
||
|
|
byLineOverviewSplit: YearlySplitData[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ChatMessage {
|
||
|
|
role: 'user' | 'model';
|
||
|
|
text: string;
|
||
|
|
timestamp: Date;
|
||
|
|
}
|
||
|
|
|
||
|
|
// New Interfaces for Dynamic Pivot Grid
|
||
|
|
export interface YearlyData {
|
||
|
|
sellOut: number;
|
||
|
|
units: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface MonthlyPivot {
|
||
|
|
monthIndex: number;
|
||
|
|
byYear: Record<string, YearlyData>;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface PivotRow {
|
||
|
|
id: string;
|
||
|
|
customer: string;
|
||
|
|
line: string;
|
||
|
|
title: string; // Added Title
|
||
|
|
articleName: string;
|
||
|
|
sku: string;
|
||
|
|
asin: string;
|
||
|
|
|
||
|
|
// Dynamic buckets
|
||
|
|
totalsByYear: Record<string, YearlyData>;
|
||
|
|
months: MonthlyPivot[]; // Always 12 elements
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface TimeSeriesData {
|
||
|
|
name: string; // e.g., "Apr '23" or "W21 '23"
|
||
|
|
sellOut: number;
|
||
|
|
units: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ComparisonTimeSeriesPoint {
|
||
|
|
week: number;
|
||
|
|
name: string; // "W1", "W2", etc.
|
||
|
|
[key: string]: number | string; // Dynamic keys like "2023_sellOut", "2024_units"
|
||
|
|
}
|