game-analysis-types
Version:
Common TypeScript types and utilities for game analysis tools.
235 lines • 5.89 kB
TypeScript
export interface Ability {
id: string;
name: string;
description: string;
type: string;
extractionConfidence?: number;
}
export interface WargearProfile {
name: string;
stats: Record<string, number | string>;
}
export interface Wargear {
id: string;
name: string;
description?: string;
points?: number;
type?: string;
profile?: WargearProfile[];
extractionConfidence?: number;
}
export interface UnitStats {
[key: string]: number | string;
}
export interface Unit {
id: string;
name: string;
type: string;
count: number;
points: number;
keywords: string[];
abilities: Ability[];
wargear: Wargear[];
stats: UnitStats;
extractionConfidence?: number;
role?: string;
}
export interface RosterSource {
type: 'file' | 'text' | 'image' | 'manual';
format: 'battlescribe' | 'xml' | 'pdf' | 'txt' | 'docx' | 'image' | 'other';
originalFilename?: string;
size?: number;
lastModified?: number;
confidence: number;
}
export interface ParsingStats {
startTime: number;
endTime: number;
duration: number;
extractionConfidence: {
overall: number;
bySection: Record<string, number>;
};
}
export interface RosterMetadata {
source: RosterSource;
format: string;
version: string;
parseConfidence: number;
parserVersion: string;
parsingStats: ParsingStats;
}
/**
* Represents a saved roster
*/
/**
* Represents a rule associated with a roster, unit, or detachment.
*/
export interface Rule {
id: string;
name: string;
description: string;
type?: string;
}
export interface Roster {
id?: string;
userId?: string;
name: string;
faction?: string;
detachment?: string;
points?: number;
totalPoints?: number;
format?: string;
gameSystem?: string;
units?: Unit[];
metadata?: RosterMetadata;
createdAt?: Date;
updatedAt?: Date;
description?: string;
rules?: Rule[];
costType?: string;
isPublic?: boolean;
tags?: string[];
strengths?: string[];
weaknesses?: string[];
opportunities?: string[];
threats?: string[];
}
/**
* Represents a single unit in a roster
* @deprecated Use Unit interface instead
*/
export interface RosterUnit {
id: string;
name: string;
role: string;
count: number;
points: number;
equipment: string[];
rules: string[];
}
export interface ValidationError {
code: string;
message: string;
path: string;
severity: 'error';
}
export interface ValidationWarning {
code: string;
message: string;
path: string;
severity: 'warning';
}
export interface ValidationResult {
valid: boolean;
errors: ValidationError[];
warnings: ValidationWarning[];
}
/**
* Assessment of a single unit in a roster
*/
export interface UnitAssessment {
unitId: string;
unitName: string;
strengths: string[];
weaknesses: string[];
tacticalAdvice: string[];
matchupRatings?: Record<string, number>;
confidence?: number;
optimalDeployment?: string;
targetPriority?: string;
synergies?: string[];
tacticalUses?: string[];
costEfficiencyRating?: number;
}
export type RosterProcessor<T = void> = (roster: Roster) => T | Promise<T>;
export type RosterValidator = (roster: Roster) => ValidationResult;
export type RosterTransformer<T = Roster> = (roster: Roster) => T;
export interface ParserIssue {
type: 'error' | 'warning' | 'info';
message: string;
code: string;
section?: string;
data?: any;
}
export interface ParserResult {
roster: Partial<Roster>;
confidence: number;
issues: ParserIssue[];
metadata: Record<string, any>;
}
export interface PerformanceMetric {
name: string;
score: number;
explanation: string;
}
/**
* Represents a meta matchup between your roster and a specific faction.
* - `faction`: The opposing faction name.
* - `matchupScore`: A numeric score indicating advantage (+), disadvantage (-), or neutral (0).
* - Positive: Favorable matchup
* - Negative: Unfavorable matchup
* - Zero: Neutral matchup
* - `commentary`: Brief tactical notes or rationale for the score.
*/
export interface MetaMatchup {
faction: string;
matchupScore: number;
commentary: string;
}
export interface RosterOverview {
summary: string;
pointsEfficiency: string;
battlefieldRole: string;
}
export interface ImprovementSuggestion {
remove: string;
add: string;
benefit: string;
}
/**
* Full tactical and meta analysis for a roster.
* Includes strengths, weaknesses, tactical advice, unit assessments, and meta positioning.
*
* `metaPositioning` provides:
* - `metaSummary`: High-level summary of meta context
* - `matchups`: Array of MetaMatchup objects for each key matchup
* - `tournamentViability`: Numeric viability score (0-10)
*/
export interface RosterAnalysis {
id: string;
rosterId: string;
userId: string;
strengths: string[];
weaknesses: string[];
opportunities: string[];
threats: string[];
tacticalAdvice: string[];
unitAssessments: UnitAssessment[];
modelUsed: string;
creditsUsed?: number;
createdAt: Date;
commandPoints?: number;
secondaryObjectives?: string[];
overallRating?: number;
tacticalRecommendations?: any[];
rosterOverview?: RosterOverview;
performanceMetrics?: PerformanceMetric[];
metaPositioning?: {
metaSummary: string;
matchups: MetaMatchup[];
tournamentViability: number;
};
improvementSuggestions?: ImprovementSuggestion[];
}
/**
* Minimal user identity/type for feature flags, batch crediting, etc.
*/
export interface User {
id: string;
tier?: string;
name?: string;
email?: string;
role?: string;
}
//# sourceMappingURL=roster.d.ts.map