import React from "react";

const ManifestsContext = React.createContext();

let busy = false;
let ecus = [
  {
    data_id: 0,
    name: "AGS",
    version: "",
    hw_version: "",
    manifest_id: 0,
    files: [
      {
        filename: "test.bin",
        order: 0,
        offset: "0",
        checksum: "",
        self_download: false,
        mode: "D",
        type: 1,
      },
    ],
  },
];
let uploadedFiles = [];
let uploadFileIndex = 0;
let uploadProgress = 0;
let uploadStatus = null;

export const ManifestCreateProvider = ({ children }) => {
  return <div data-testid="mocked-manifestcreateprovider">{children}</div>;
};

export const useManifestCreateContext = () => ({
  busy,
  ecus,
  uploadedFiles,
  uploadFileIndex,
  uploadProgress,
  uploadStatus,
  addECU: jest.fn(),
  addECUFile: jest.fn(),
  cancelUpload: jest.fn(),
  createManifest: jest.fn(),
  createManifestECU: jest.fn(),
  deleteECU: jest.fn(),
  deleteECUFile: jest.fn(),
  updateECUs: jest.fn(),
});
