import {
  Account,
  CompanyParams,
} from '@/packages/features/accounts/src/types/accounts';
import { PiggyBankIcon } from 'lucide-react';

import { Separator } from '@kit/ui/shadcn/separator';
import { Trans } from '@kit/ui/trans';

import { TeamAccountBenefitExpensesOverview } from '../../_lib/server/load-team-account-benefit-expenses-overview';
import HealthBenefitFormClient from './health-benefit-form-client';
import YearlyExpensesOverview from './yearly-expenses-overview';

const HealthBenefitForm = async ({
  account,
  companyParams,
  employeeCount,
  expensesOverview,
}: {
  account: Account;
  companyParams: CompanyParams;
  employeeCount: number;
  expensesOverview: TeamAccountBenefitExpensesOverview;
}) => {
  return (
    <div className="flex flex-col gap-6 px-6 text-left">
      <div className="mt-8 flex items-center justify-between">
        <div>
          <h4>
            <Trans
              i18nKey="billing:pageTitle"
              values={{ companyName: account.name }}
            />
          </h4>
        </div>
      </div>

      <div className="flex flex-col-reverse gap-6 sm:flex-row">
        <div className="border-border w-full rounded-lg border sm:w-1/3">
          <div className="p-6">
            <div className="flex h-16 w-16 items-center justify-center rounded-full bg-orange-100">
              <PiggyBankIcon className="h-[32px] w-[32px] stroke-orange-400 stroke-2" />
            </div>
            <p className="mt-4 text-sm font-medium">
              <Trans i18nKey="billing:healthBenefitForm.description" />
            </p>
          </div>

          <Separator />

          <div className="p-6">
            <HealthBenefitFormClient
              account={account}
              companyParams={companyParams}
            />
          </div>
        </div>

        <div className="flex-1 space-y-6">
          <YearlyExpensesOverview
            employeeCount={employeeCount}
            expensesOverview={expensesOverview}
          />

          <p className="text-muted-foreground text-sm">
            <Trans i18nKey="billing:healthBenefitForm.info" />
          </p>
        </div>
      </div>
    </div>
  );
};

export default HealthBenefitForm;
