// Copyright 2014 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BUFFET_COMMANDS_COMMAND_DICTIONARY_H_
#define BUFFET_COMMANDS_COMMAND_DICTIONARY_H_

#include <map>
#include <memory>
#include <string>
#include <vector>

#include <base/basictypes.h>

#include "buffet/error.h"

namespace base {
class Value;
class DictionaryValue;
}  // namespace base

namespace buffet {

class CommandDefinition;

// CommandDictionary is a wrapper around a map of command name and the
// corresponding command definition schema. The command name (the key in
// the map) is a compound name in a form of "package_name.command_name",
// where "package_name" is a name of command package such as "base", "printers",
// and others. So the full command name could be "base.reboot", for example.
class CommandDictionary {
 public:
  CommandDictionary() = default;

  // Gets the list of names of commands that belong to the given category.
  std::vector<std::string> GetCommandNamesByCategory(
      const std::string& category) const;

  // Loads command definitions from a JSON object. This is done at the daemon
  // startup and whenever a device daemon decides to update its command list.
  // |json| is a JSON dictionary that describes the complete commands contained
  // in a particular |category|. Usually, |categories| are 1:1 with daemons on
  // a device. For instance, the power manager daemon might provide a category
  // "power_man" that provides the "base.reboot" and "base.shutdown" commands.
  // However, nothing prohibits a daemon providing commands in two categories.
  // When LoadCommands is called, all previous definitions of commands from the
  // same category are removed, effectively replacing all the commands in the
  // given category.
  // Optional |base_commands| parameter specifies the definition of standard
  // GCD commands for parameter schema validation. Can be set to nullptr if
  // no validation is needed.
  // Returns false on failure and |error| provides additional error information
  // when provided.
  bool LoadCommands(const base::DictionaryValue& json,
                    const std::string& category,
                    const CommandDictionary* base_commands, ErrorPtr* error);
  // Returns the number of command definitions in the dictionary.
  size_t GetSize() const { return definitions_.size(); }
  // Checks if the dictionary has no command definitions.
  bool IsEmpty() const { return definitions_.empty(); }
  // Remove all the command definitions from the dictionary.
  void Clear();
  // Finds a definition for the given command.
  const CommandDefinition* FindCommand(const std::string& command_name) const;

 private:
  using CommandMap = std::map<std::string,
                              std::shared_ptr<const CommandDefinition>>;

  CommandMap definitions_;  // List of all available command definitions.
  DISALLOW_COPY_AND_ASSIGN(CommandDictionary);
};

}  // namespace buffet

#endif  // BUFFET_COMMANDS_COMMAND_DICTIONARY_H_
