export interface OpsAppBlock {
  app: string;
  generated_at: string;
}

export interface OpsEconomyBlock {
  mrr: number | null;
  intakt_24h: number | null;
  intakt_7d: number | null;
  valuta: "SEK";
}

export interface OpsUsersBlock {
  aktiva_nu: number;
  dau: number;
  mau: number;
  nya_24h: number;
  nya_7d: number;
}

export interface OpsSubscriptionsBlock {
  trial_aktiva: number;
  trial_konverterade_24h: number;
  trial_konverterade_7d: number;
  konverteringsgrad_30d: number | null;
  betalande: number;
  avslutade_24h: number;
}

export interface OpsStoreBlock {
  butik: null;
  all_fields_phase_2: null;
}

export interface OpsFeedbackItem {
  rubrik: string;
  typ: "bug" | "onskemal";
  status: "oppen" | "pagar" | "stangd";
  created_at: string;
}

export interface OpsFeedbackBlock {
  oppna: number;
  nya_24h: number;
  senaste: OpsFeedbackItem[] | null;
}

export interface OpsAiScanBlock {
  scans_24h: number;
  scans_7d: number;
  lyckandegrad_24h: number | null;
  latens_p50_ms: number | null;
  latens_p95_ms: number | null;
  felfrekvens_24h: number | null;
  senaste_fel: Array<{ kod: string | null; tid: string }> | null;
  kostnad_usd_mikrocent_manad: number;
  kostnad_usd_mikrocent_24h: number | null;
  kostnad_usd_mikrocent_24h_uppskattad: boolean;
  budget_andel: number | null;
  as_of: string;
}

export interface OpsActivationBlock {
  scan_inom_24h_andel: number | null;
  lagad_maltid_inom_7d_andel: number | null;
  hushall_andra_medlem_aktiv_andel: number | null;
  retention_d1: number | null;
  retention_d7: number | null;
  retention_d30: number | null;
}

export interface OpsEngagementBlock {
  lagade_maltider_24h: number;
  lagade_maltider_7d: number;
  rek_ctr_7d: number | null;
  puffar_skickade_24h: number;
  puffar_atgardsgrad_7d: number | null;
}

export interface OpsPaymentBlock {
  failed_nu: number;
  grace_period_nu: number;
  trials_utgar_48h: number;
  aterbetalningar_7d: number | null;
  chargebacks_7d: number | null;
}

export interface OpsQueueBlock {
  vantande: number;
  aktiva: number;
  misslyckade_24h: number;
  aldsta_vantande_sek: number | null;
  workers_ok: boolean;
}

export interface OpsSafetyBlock {
  allergen_invariant_brott: number;
  overifierade_visade: number;
  food_safety_lint_avvisade_7d: number | null;
  senaste_kontroll: string | null;
}

export interface OpsWallTile {
  label: string;
  value: string;
  tone: "ok" | "warn" | "crit";
}

export interface OpsWallBoard {
  title: string;
  tiles: OpsWallTile[];
}

export interface OpsWallBlock {
  boards: OpsWallBoard[];
}

export interface OpsAlarm {
  typ: string;
  rubrik: string;
  detalj?: string;
  allvarlighetsgrad: "warn" | "crit";
  created_at: string;
}

export interface OpsAlarmBlock {
  larm: OpsAlarm[];
}

export interface OpsGeminiBlock {
  anrop_24h: number | null;
  prompt_tokens_24h: number | null;
  output_tokens_24h: number | null;
  total_tokens_24h: number | null;
  total_tokens_manad: number | null;
  kostnad_usd_mikrocent_24h: number | null;
  andel_pa_aamos: number;
  aamos_agreement: string | null;
}

export interface OpsSummary {
  app: OpsAppBlock;
  ekonomi: OpsEconomyBlock;
  anvandare: OpsUsersBlock;
  prenumerationer: OpsSubscriptionsBlock;
  butik: OpsStoreBlock;
  feedback: OpsFeedbackBlock;
  ai_scan: OpsAiScanBlock;
  aktivering: OpsActivationBlock;
  engagemang: OpsEngagementBlock;
  betalning: OpsPaymentBlock;
  jobb: OpsQueueBlock;
  sakerhet: OpsSafetyBlock;
  larm: OpsAlarmBlock;
  wall: OpsWallBlock;
  gemini: OpsGeminiBlock;
  as_of: string;
}
