import { RemissionProcess } from '../../models/remission-process';
import { remissionCapacities } from './remission-capacities';
import { createRandomStringId, createRandomId } from '../util';
import { remissionFilter } from './remission-filter';
import { ShippingDocument } from '../../models';

export const remissionProcessTemplateMock: RemissionProcess = {
  id: createRandomId(),
  returnGroup: createRandomId(),
  stockId: createRandomId(),
  capacities: remissionCapacities,
  filter: remissionFilter,
};

export const remissionProcessTemplates: RemissionProcess[] = [remissionProcessTemplateMock];

export function createRemissionProcessFromTemplate(remission: RemissionProcess): RemissionProcess {
  const shippingDocuments = [{ id: createRandomId(), shippingDocumentNumber: createRandomStringId(), products: [] } as ShippingDocument];
  const remissionId = createRandomId();

  return { ...remission, externalId: remissionId, shippingDocuments };
}
