import { VNode, h } from "preact";
import { Pages } from "../pages.js";
import { AmlRecords, AmlState } from "../types.js";
import { InputChoiceHorizontal } from "../handlers/InputChoiceHorizontal.js";
import { createNewForm } from "../handlers/forms.js";
import { TranslatedString } from "@gnu-taler/taler-util";
import { amlStateConverter as amlStateConverter } from "./CaseDetails.js";
import { useState } from "preact/hooks";
import { HandleAccountNotReady } from "./HandleAccountNotReady.js";
import { useOfficer } from "../hooks/useOfficer.js";
const response: AmlRecords = {
  records: [
    {
      current_state: 0,
      h_payto: "QWEQWEQWEQWEWQE",
      rowid: 1,
      threshold: "USD 100",
    },
    {
      current_state: 1,
      h_payto: "ASDASDASD",
      rowid: 1,
      threshold: "USD 100",
    },
    {
      current_state: 2,
      h_payto: "ZXCZXCZXCXZC",
      rowid: 1,
      threshold: "USD 1000",
    },
    {
      current_state: 0,
      h_payto: "QWEQWEQWEQWEWQE",
      rowid: 1,
      threshold: "USD 100",
    },
    {
      current_state: 1,
      h_payto: "ASDASDASD",
      rowid: 1,
      threshold: "USD 100",
    },
    {
      current_state: 2,
      h_payto: "ZXCZXCZXCXZC",
      rowid: 1,
      threshold: "USD 1000",
    },
  ].map((e, idx) => {
    e.rowid = idx;
    e.threshold = `${e.threshold}${idx}`;
    return e;
  }),
};
function doFilter(
  list: typeof response.records,
  filter: AmlState | undefined,
): typeof response.records {
  if (filter === undefined) return list;
  return list.filter((r) => r.current_state === filter);
}
export function Cases() {
  const officer = useOfficer();
  if (officer.state !== "ready") {
    return 
A list of all the account with the status
| Account Id | Status | Threshold | 
|---|---|---|
| {((state: AmlState): VNode => { switch (state) { case AmlState.normal: { return ( Normal ); } case AmlState.pending: { return ( Pending ); } case AmlState.frozen: { return ( Frozen ); } } })(r.current_state)} | {r.threshold} |