import { CustomerPageShell } from "@/app/customer/_components/customer-page-shell";
import {
  parseCustomerRecordViewParams,
  type CustomerRecordViewPageProps,
} from "@/app/customer/_lib/parse-customer-record-view-params";

import { FxAccumulatorViewPage } from "../_components/fx-accumulator-view-page";
import { fetchFxAccumulatorViewPageData } from "../_lib/fetch-fx-accumulator-view-page";

export default async function FxAccumulatorRecordViewPage(props: CustomerRecordViewPageProps) {
  const { tenant, id, customerId, backHref } = await parseCustomerRecordViewParams(
    props,
    "/fx-currency/fx-accumulator",
  );
  const data = await fetchFxAccumulatorViewPageData(tenant, id, customerId);

  return (
    <CustomerPageShell>
      <div className="px-1 py-2 sm:px-2">
        <FxAccumulatorViewPage
          tenant={tenant}
          data={data}
          customerId={customerId}
          backHref={backHref}
        />
      </div>
    </CustomerPageShell>
  );
}
