export type AdminRole = "viewer" | "operator" | "superadmin";

export type AdminSessionResponse = {
  expiresAt: string;
  operatorEmail: string;
  operatorId: string;
  role: AdminRole;
  sessionToken: string;
};

export type AdminSessionInfo = {
  aud: string;
  exp: number;
  operatorEmail: string;
  operatorId: string;
  role: AdminRole;
};

export type AdminTableSummary = {
  id: string;
  label: string;
};

export type AdminTableColumn = {
  id: string;
  label: string;
};

export type AdminTableMeta = {
  columns: AdminTableColumn[];
  editableFields: string[];
  id: string;
  label: string;
  primaryKey: string;
};

export type AdminOverviewMetric = {
  changeLabel: string;
  id: string;
  label: string;
  value: string;
};

export type AdminOverviewAlert = {
  description: string;
  id: string;
  severity: "info" | "warning" | "critical";
  title: string;
};

export type AdminOverviewShortcut = {
  href: string;
  id: string;
  label: string;
};

export type AdminOverviewResponse = {
  alerts: AdminOverviewAlert[];
  metrics: AdminOverviewMetric[];
  shortcuts: AdminOverviewShortcut[];
};

export type AdminDatasetChartType = "bar" | "line" | "donut";

export type AdminDatasetSummary = {
  description: string;
  id: string;
  label: string;
};

export type AdminDatasetPoint = {
  label: string;
  value: number;
};

export type AdminDatasetResult = AdminDatasetSummary & {
  chartType: AdminDatasetChartType;
  dimensionLabel: string;
  metricLabel: string;
  points: AdminDatasetPoint[];
};

export type AdminActionField = {
  id: string;
  label: string;
  placeholder?: string;
  required?: boolean;
};

export type AdminActionSummary = {
  description: string;
  fields: AdminActionField[];
  id: string;
  label: string;
};

export type AdminActionRunResponse = {
  message: string;
  success: boolean;
};
