// in cypress/support/index.d.ts
// load type definitions that come with Cypress module
/// <reference types="cypress" />

import { ExtractRouteParams } from 'react-router'
import { TCarFixturePath } from '../utils/fixtures'
import { TRoutePath } from '../../src/constants/routePaths'

declare global {
  declare namespace Cypress {
    interface Chainable {
      /**
       * Custom command to increment the state of the CounterReducer by a given value or default value 3
       * @example cy.incrementCounterReducer()
       *
       * @param incrementBy
       */
      incrementCounterReducer(incrementBy?: number): Chainable<Element>

      /**
       * Uses a provided route key to navigate to route
       * @param routeKey
       * @param generatePathOptions
       * @param visitOptions
       */
      visitRoute<Route extends TRoutePath>(
        routeKey: Route,
        generatePathOptions?: ExtractRouteParams<Route>,
        visitOptions?: Partial<VisitOptions>
      ): Chainable<AUTWindow>

      // TODO(ProjectSetup): method used for mocking a GET /cars request
      //  to be deleted
      interceptGetCars(fixturePath?: TCarFixturePath): void
    }
  }
}
