import { parseAsStringLiteral } from 'nuqs';

import { type ExchangePill, ExchangeStatus } from './types';

export const ExchangesTab = {
  Catalog: 'CATALOG',
  History: 'HISTORY',
} as const;

export const exchangesTabParser = parseAsStringLiteral(
  Object.values(ExchangesTab),
).withDefault(ExchangesTab.Catalog);

export const EXCHANGE_STATUS_PILL: Record<ExchangeStatus, ExchangePill> = {
  [ExchangeStatus.DELIVERED]: {
    type: 'success',
    labelKey: 'products.delivered',
  },
  [ExchangeStatus.PENDING_DELIVERY]: {
    type: 'warning',
    labelKey: 'products.pending',
  },
  [ExchangeStatus.EXPIRED]: { type: 'error', labelKey: 'products.expired' },
};
