import { TableArrangement } from '@/app/lib/definitions';

export function loadTableSimulations(onLoad?: (tableSimulations: TableArrangement[]) => void) {
  fetch('/api/tables_arrangements')
    .then((response) => response.json())
    .then((data) => {
      onLoad && onLoad(data.map((record: any) => {
        return ({
          id: record.id,
          name: record.name,
          discomfort: record.discomfort,
        });
      }));
    }, (error) => {
      return [];
    });
}