/**
 * Generated by orval v8.23.0 🍺
 * Do not edit manually.
 * FastAPI
 * OpenAPI spec version: v2.2.0
 */
import type {
  DataFiltersResponse,
  DataTeamResponse,
  GetDataDataGetGetParams,
  GetDataFiltersDataFiltersGetParams,
  HTTPValidationError
} from '../model';

import { customInstance } from '.././client';

export type getDataFiltersDataFiltersGetResponse200 = {
  data: DataFiltersResponse
  status: 200
}

export type getDataFiltersDataFiltersGetResponse422 = {
  data: HTTPValidationError
  status: 422
}

export type getDataFiltersDataFiltersGetResponseSuccess = (getDataFiltersDataFiltersGetResponse200) & {
  headers: Headers;
};
export type getDataFiltersDataFiltersGetResponseError = (getDataFiltersDataFiltersGetResponse422) & {
  headers: Headers;
};

export type getDataFiltersDataFiltersGetResponse = (getDataFiltersDataFiltersGetResponseSuccess | getDataFiltersDataFiltersGetResponseError)

export const getGetDataFiltersDataFiltersGetUrl = (params: GetDataFiltersDataFiltersGetParams,) => {
  const normalizedParams = new URLSearchParams();

  Object.entries(params || {}).forEach(([key, value]) => {

    if (value !== undefined) {
      normalizedParams.append(key, value === null ? 'null' : String(value))
    }
  });

  const stringifiedParams = normalizedParams.toString();

  return stringifiedParams.length > 0 ? `/data/filters?${stringifiedParams}` : `/data/filters`
}

/**
 * For a year, list of event codes, and list of team numbers, return a JSON object
 *     containing the available filters that can additionally be applied
 *
 * For example, if just a year is given, return all team numbers and events with data on the server.
 * If a year and event code is given, return all team numbers for that event and year with data on the server.
 * If a year and multiple event codes are given, return all team numbers which have data on the server for those event codes and year.
 * If a year and a team number is given, return all event codes which have data on the server for that team number and year.
 * If a year and multiple team numbers are given, return all event codes which have data on the server for those team numbers and year.
 * @summary Get Data Filters
 */
export const getDataFiltersDataFiltersGet = async (params: GetDataFiltersDataFiltersGetParams, options?: Parameters<typeof customInstance>[1]): Promise<getDataFiltersDataFiltersGetResponse> => {

  return customInstance<getDataFiltersDataFiltersGetResponse>(getGetDataFiltersDataFiltersGetUrl(params),
  {
    ...options,
    method: 'GET'


  }
);}


export type getDataDataGetGetResponse200 = {
  data: DataTeamResponse[]
  status: 200
}

export type getDataDataGetGetResponse422 = {
  data: HTTPValidationError
  status: 422
}

export type getDataDataGetGetResponseSuccess = (getDataDataGetGetResponse200) & {
  headers: Headers;
};
export type getDataDataGetGetResponseError = (getDataDataGetGetResponse422) & {
  headers: Headers;
};

export type getDataDataGetGetResponse = (getDataDataGetGetResponseSuccess | getDataDataGetGetResponseError)

export const getGetDataDataGetGetUrl = (params: GetDataDataGetGetParams,) => {
  const normalizedParams = new URLSearchParams();

  Object.entries(params || {}).forEach(([key, value]) => {

    if (value !== undefined) {
      normalizedParams.append(key, value === null ? 'null' : String(value))
    }
  });

  const stringifiedParams = normalizedParams.toString();

  return stringifiedParams.length > 0 ? `/data/get?${stringifiedParams}` : `/data/get`
}

/**
 * Given a year, event codes, and team numbers, return the data that matches those filters
 *
 * Data should be structured based on the stat_type and game_piece of the associated MatchScoutingField.
 * The data should be a list of JSON objects. Each object represents a team with data. In that object,
 *     there should be four lists: teleop, auton, capability, other
 * teleop and auton should be a list of JSON objects, for each game_piece for that season.
 *     Then, for each game piece, it should be a list of JSON objects that represents each individual field with type: auton_score, auton_miss, teleop_score, teleop_miss
 *     These fields should have the field type, name, uuid, list of all data points, and the minimum, the maximum, and the average (if applicable).
 *
 * For example, there are two game pieces. Coral and Algae. There is a field for how much coral was scored and how much were dropped, both as a teleop_score.
 *     There will be a list of JSON objects for each team. In the team object, inside the teleop list, there should be two additional lists, one for coral and one for algae.
 *     Then there will two more JSON objects for both of those fields, with the field type, name, uuid, and list of all data points.
 *
 * Next, for capabilities, find each field that is a capability and find the percentages of each value occurrence. This will most likely
 *     be something that is a multiple_choice or choice MatchScoutingField, and we'll want to show how often each value occurred using something like a pie chart.
 *
 * Finally, for other, simply return the same field information and the value, as this will likely be a text input.
 *
 * [
 *     {
 *         "team_number": 1234,
 *         "nickname": "Team 1234",
 *         "teleop": [
 *             "coral": [
 *                 {
 *                     "field_uuid": "uuid",
 *                     "field_type": "small_number",
 *                     "field_name": "Coral scored",
 *                     "values": [1, 2, 3, ...],
 *                     "min": 0,
 *                     "max": 100,
 *                     "avg": 50
 *                 },
 *                 {
 *                     "field_uuid": "uuid",
 *                     "field_type": "small_number",
 *                     "field_name": "Coral dropped",
 *                     "values": [1, 2, 3, ...],
 *                     "min": 0,
 *                     "max": 100,
 *                     "avg": 50
 *                 }
 *             ],
 *             "algae": [...],
 *         ],
 *         "auton": [...],
 *         "capability": [
 *             {
 *                 "field_uuid": "uuid",
 *                 "field_type": "choice",
 *                 "field_name": "Climb level",
 *                 "values": ["low", "medium", "high"],
 *                 "percentages": [
 *                     {
 *                         "value": "low",
 *                         "percentage": 50
 *                     }, {
 *                         "value": "medium",
 *                         "percentage": 25
 *                     }, {
 *                         "value": "high",
 *                         "percentage": 25
 *                     }
 *                 ],
 *                 ...
 *             }
 *         ],
 *         "other": [
 *             {
 *                 "field_uuid": "uuid",
 *                 "field_type": "string",
 *                 "field_name": "Notes",
 *                 "value": "Some notes",
 *             },
 *             ...
 *         ]
 *     },
 *     ...
 * ]
 * @summary Get Data
 */
export const getDataDataGetGet = async (params: GetDataDataGetGetParams, options?: Parameters<typeof customInstance>[1]): Promise<getDataDataGetGetResponse> => {

  return customInstance<getDataDataGetGetResponse>(getGetDataDataGetGetUrl(params),
  {
    ...options,
    method: 'GET'


  }
);}


