import type { GrowthAnalysis, SavedAdvisorAdvice } from '@/types/growth-score';

export type DashboardCompany = {
    id: number;
    name: string;
    base_currency: string;
    external_company_id: string | null;
    external_account_type: string | null;
};

export type DashboardProps = {
    company: DashboardCompany | null;
    connected: boolean;
    analysis: GrowthAnalysis | null;
    summary:
        | (GrowthAnalysis['metrics'] & {
              growth_score: number | null;
              grade: string | null;
              trend: string;
          })
        | null;
    trend: {
        points: { period: string; score: number | null }[];
        latest_period: { from_year: number; to_year: number } | null;
    } | null;
    recent_financials: {
        year: number;
        revenue: number;
        net_income: number;
    }[];
    actions: {
        advice: SavedAdvisorAdvice | null;
        has_advice: boolean;
    };
    data_health: {
        status:
            | 'no_company'
            | 'not_connected'
            | 'healthy'
            | 'insufficient_history'
            | 'refreshing'
            | 'error'
            | string;
        message?: string;
        synced_at?: string | null;
        refreshing?: boolean;
        last_error?: string | null;
        missing_years?: number[];
        has_sign_flips?: boolean;
        coverage_years?: number;
    };
};
