import { cache } from "react";
import "server-only";

export interface ClaimResult {
  id: number;
  created: string;
  name: string;
  cost: number;
  type: "Expense" | "Petty Cash";
  status: "Not Submitted" | "Waiting for Approval" | "Approved" | "Rejected";
  remarks: string;
}

export const preloadClaims = () => {
  fetchClaims();
};

export const fetchClaims = cache(async () => {
  return mockClaims;
});

const mockClaims: ClaimResult[] = [
  {
    id: 1,
    created: "2023-11-22",
    name: "Consultancy Project A",
    cost: 121.0,
    type: "Expense",
    status: "Not Submitted",
    remarks: "",
  },
  {
    id: 2,
    created: "2023-11-30",
    name: "Consultancy Project A",
    cost: 4300.0,
    type: "Expense",
    status: "Waiting for Approval",
    remarks: "",
  },
  {
    id: 3,
    created: "2023-12-12",
    name: "Construction Project C",
    cost: 3675.0,
    type: "Petty Cash",
    status: "Rejected",
    remarks: "Duplicate Claim Form",
  },
];
