import { MergePartialWithRegular, UnionToIntersection } from '../../../../shared';
import { HISTORY_CODES } from '../codes';

import {
  CollateralHistoryItem,
  ExpandedHistoryItem,
  HistoryAccess,
  L1TxHistoryItem,
  ShortHistoryItem,
} from './entities';

export type HistoryAccessClaimBody = HistoryAccess;

type RegularHistoryClaimFields = { code: HISTORY_CODES; txId: string };

export type HistoryItemClaimBody = UnionToIntersection<
  | MergePartialWithRegular<ShortHistoryItem, RegularHistoryClaimFields>
  | MergePartialWithRegular<ExpandedHistoryItem, RegularHistoryClaimFields>
  | MergePartialWithRegular<CollateralHistoryItem, RegularHistoryClaimFields>
  | MergePartialWithRegular<L1TxHistoryItem, RegularHistoryClaimFields>
>;
