import React from "react";

const ManifestsContext = React.createContext();

let busy = false;
let manifest = {
  id: 1,
  name: "Test Deployment",
  version: "1.0.100",
  description: "Deployment folder test",
  release_notes: "https://releasenotes.com",
  ecu_list: "ICC 1000",
  ecu_updates: [
    {
      name: "ICC",
      part_number: "BBBBBB",
      version: "1000",
      files: [
        {
          file_id: "b0cda514c94080b4",
          url: "https://upload-dev.fiskerdps.com/92bbc448-99c8-4851-91ad-f8042e4deb49/LARGE.jpg",
          write_region: {
            offset: 100,
            length: 14488498,
          },
          erase_region: {
            offset: 0,
            length: 120559274,
          },
          file_size: 14559274,
          type: "ODX Data",
          created: "2021-12-09T22:38:29.102813Z",
          updated: "2021-12-09T22:38:29.102813Z",
        },
        {
          file_id: "4B897b1DcbeCds8e9",
          url: "https://upload-dev.fiskerdps.com/92bbc448-99c8-4851-91ad-f8042e4deb49/SMALL.jpg",
          write_region: {
            offset: 120559274,
            length: 559274,
          },
          checksum: "0a06d87c",
          file_size: 488498,
          type: "ODX Data",
          created: "2021-12-09T22:38:29.102813Z",
          updated: "2021-12-09T22:38:29.102813Z",
        },
      ],
      created: "2021-12-09T22:38:20.408351Z",
      updated: "2022-01-14T00:47:08.996451Z",
    },
  ],
  created: "2021-12-09T22:38:11.679943Z",
  updated: "2022-01-14T00:47:08.996451Z",
  active: true,
  sums: "2023.03.00.00.E",
  notify_sap: false,
};
let manifests = [
  {
    id: 1,
    name: "Test Manifest",
    version: "1.0",
    created: "2021-07-01T22:40:07.778509Z",
    updated: "2021-07-12T18:22:13.736755Z",
    active: true,
    sums: "2023.03.00.00.E",
    notify_sap: false,
  },
];
let totalManifests = 1;

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

export const useManifestsContext = () => ({
  busy,
  manifests,
  totalManifests,
  getManifest: jest.fn(() => manifest),
  getManifests: jest.fn(() => manifests),
  deleteManifest: jest.fn(),
  updateManifest: jest.fn(() => manifest),
});
