import React from "react";

let busy = false;
let vehicles = [];
let models = ["Ocean", "PEAR"];
let years = [2023, 2024];
let totalVehicles = 0;
let error = null;

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

export const useVehicleContext = () => ({
  busy,
  vehicles,
  totalVehicles,
  models,
  years,
  getVehicles: jest.fn(() => vehicles),
  addVehicle: jest.fn(),
  getModels: jest.fn(() => {
    models = ["Ocean", "PEAR"];
  }),
  getYears: jest.fn(() => {
    years = [2023, 2024];
  }),
});

export const setBusy = (val) => {
  busy = val;
};

export const setVehicles = (val) => {
  vehicles = val;
};
