interface CPWebCommand {
  command?: string;
  funct?: string;
}

interface setPlayerCommand extends CPWebCommand {
  deploymentId: string;
  logLevel: string;
  playerName: string;
  url: string;
  version: string;
}

// type Primitive = string | number | boolean | null | undefined;

export function routeMessage(message: setPlayerCommand) {
  switch (message.command) {
    case "setHost": {
      const response: setPlayerCommand = {
        command: 'setPlayer',
        logLevel: `${message.logLevel}`,
        playerName: "Dickey's Fake CPWeb Device",
        url: "http://192.168.1.15:8080",
        version: "9.9.9",
        deploymentId: "foo-bar",
      };
      return response;
    }

    default: {
      console.warn("Unknown command:", message.command);
    }
  }
}
