import { component } from '@blocklet/sdk';
import type { LiteralUnion } from 'type-fest';
import { withQuery } from 'ufo';
import { getConnectQueryParam } from './util';

export function getCustomerPayoutPageUrl({
  payoutId,
  userDid,
  locale = 'en',
  action = '',
}: {
  payoutId: string;
  userDid: string;
  locale: LiteralUnion<'en' | 'zh', string>;
  action?: LiteralUnion<'pay', string>;
}) {
  return component.getUrl(
    withQuery(`customer/payout/${payoutId}`, {
      locale,
      action,
      ...getConnectQueryParam({ userDid }),
    })
  );
}
