export type JsonPrimitive = null | boolean | string | number;
export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
export type JsonObject = { [key: string]: JsonValue };

export interface Proof {
  type: "bulla/ed25519-2026";
  purpose:
    | "content"
    | "occurrence"
    | "authorization"
    | "witness-checkpoint";
  issuer: string;
  verificationMethod: string;
  proofValue: string;
}

export interface SignerMaterial {
  issuer: string;
  publicJwk: JsonWebKey;
  privateJwk: JsonWebKey;
}

export interface ComputedCoverageDimension {
  anchor_id: string;
  status: "COMPUTED";
  receipted: number;
  total: number;
  uncovered: string[];
  reasons: [];
}

export interface UncomputedCoverageDimension {
  anchor_id: string;
  status: "NOT_COMPUTED";
  receipted: null;
  total: null;
  uncovered: [];
  reasons: (
    | "DENOMINATOR_MISSING"
    | "DENOMINATOR_EMPTY"
    | "DENOMINATOR_DUPLICATE_ID"
    | "DENOMINATOR_MALFORMED"
  )[];
}

export type CoverageDimension =
  | ComputedCoverageDimension
  | UncomputedCoverageDimension;

export interface CoverageReport {
  decision: CoverageDimension;
  effect: CoverageDimension;
}

export class HttpError extends Error {
  constructor(
    readonly status: number,
    readonly code: string,
    message: string,
  ) {
    super(message);
  }
}
