import React from "react";

const UpdatesContext = React.createContext();

let busy = false;
let packages = [];
const examplePackage = {
  id: 0,
  package_name: "Package",
  version: "1.0",
  desc: "Description",
  release_notes: "https://www.google.com/",
  created: Date.now().toString(),
};
packages.push(examplePackage)
let totalPackages = 0;
let carUpdates = [];
let totalCarUpdates = 0;

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

export const useUpdatesContext = () => ({
  busy,
  packages,
  totalPackages,
  carUpdates,
  totalCarUpdates,
  getPackages: jest.fn(() => packages),
  updatePackage: jest.fn((data) => data),
  createCarUpdates: jest.fn((data) => data),
  getCarUpdates: jest.fn(() => carUpdates),
  getVINUpdates: jest.fn(() => carUpdates),
  startMonitor: jest.fn(),
  stopMonitor: jest.fn(),
});
