import { hashOptionIds } from './hash';

export interface DefaultSkuInput {
  dealId: string;
  originalPrice: string;
  discountPercent: number;
  discountedPrice: string;
  quantityTotal: number;
}

export interface DefaultSkuRow {
  dealId: string;
  optionIds: string[];
  optionIdsHash: string;
  originalPrice: string;
  discountPercent: number;
  discountedPrice: string;
  quantityTotal: number;
  quantitySold: number;
  isActive: boolean;
}

export function buildDefaultSkuRow(input: DefaultSkuInput): DefaultSkuRow {
  return {
    dealId: input.dealId,
    optionIds: [],
    optionIdsHash: hashOptionIds([]),
    originalPrice: input.originalPrice,
    discountPercent: input.discountPercent,
    discountedPrice: input.discountedPrice,
    quantityTotal: input.quantityTotal,
    quantitySold: 0,
    isActive: true,
  };
}
