/**
 * Shell EVLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import {
  array,
  lazy,
  number,
  object,
  optional,
  Schema,
  string,
} from '../schema';
import { Coordinates, coordinatesSchema } from './coordinates';
import {
  SingleLocationMarkerAuthorizationMethodsItemsEnum,
  singleLocationMarkerAuthorizationMethodsItemsEnumSchema,
} from './singleLocationMarkerAuthorizationMethodsItemsEnum';
import {
  SingleLocationMarkerStatusEnum,
  singleLocationMarkerStatusEnumSchema,
} from './singleLocationMarkerStatusEnum';

/** A Marker is a place on the map that represent a single Location */
export interface SingleLocationMarker {
  /** Identifies the marker type. If it’s a `SingleLocationMarker`, then the value is `SingleLocation` */
  markerType: string;
  /** Uniquely identifies the marker object */
  uniqueKey?: string;
  status?: SingleLocationMarkerStatusEnum;
  /** Coordinates of the Shell Recharge Site Location */
  coordinates?: Coordinates;
  /** Total number of Evse units in Locations that this Marker represents */
  evseCount?: number;
  /** Maximum power in kW across all locations grouped in this marker (disregarding availability) */
  maxPower?: number;
  /** GeoHash of marker coordinates */
  geoHash?: string;
  /** Unique ID of the Location this Marker represents */
  locationUid?: number;
  /** Methods that can be used to Authorize sessions on this EVSE */
  authorizationMethods?: SingleLocationMarkerAuthorizationMethodsItemsEnum[];
  /** Unique Id of the operator */
  operatorId?: string;
}

export const singleLocationMarkerSchema: Schema<SingleLocationMarker> = object({
  markerType: ['markerType', string()],
  uniqueKey: ['uniqueKey', optional(string())],
  status: ['status', optional(singleLocationMarkerStatusEnumSchema)],
  coordinates: ['coordinates', optional(lazy(() => coordinatesSchema))],
  evseCount: ['evseCount', optional(number())],
  maxPower: ['maxPower', optional(number())],
  geoHash: ['geoHash', optional(string())],
  locationUid: ['locationUid', optional(number())],
  authorizationMethods: [
    'authorizationMethods',
    optional(array(singleLocationMarkerAuthorizationMethodsItemsEnumSchema)),
  ],
  operatorId: ['operatorId', optional(string())],
});
