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

[
  {
    "namespace": "echoPrivate",
    "compiler_options": {
      "implemented_in": "chrome/browser/chromeos/extensions/echo_private_api.h"
    },
    "description": "none",
    "platforms": ["chromeos"],
    "functions": [
      {
        "name": "setOfferInfo",
        "description": "Sets the offer info in Local State.",
        "type": "function",
        "parameters": [
          {
            "name": "id",
            "type": "string",
            "description": "The service id of the echo offer."
          },
          {
            "name": "offerInfo",
            "type": "object",
            "additionalProperties": { "type": "any" },
            "description": "The offer info."
          }
        ]
      },
      {
        "name": "getOfferInfo",
        "description": "Check in Local State for the offer info.",
        "type": "function",
        "parameters": [
          {
            "name": "id",
            "type": "string",
            "description": "The service id of the offer eligibility check."
          },
          {
            "name": "callback",
            "type": "function",
            "parameters": [
              {
                "name": "result",
                "type": "object",
                "additionalProperties": { "type": "any" },
                "description": "The returned offer info. If the offer info is not available, api will raise error."
              }
            ]
          }
        ]
      },
      {
        "name": "getRegistrationCode",
        "description": "Get the group or coupon code from underlying storage.",
        "type": "function",
        "parameters": [
          {
            "name": "type",
            "type": "string",
            "description": "Type of coupon code requested to be read (coupon or group)."
          },
          {
            "name": "callback",
            "type": "function",
            "parameters": [
              {
                "name": "result",
                "type": "string",
                "description" : "The coupon code."
              }
            ]
          }
        ]
      },
      {
        "name": "getOobeTimestamp",
        "description": "Get the OOBE timestamp.",
        "type": "function",
        "parameters": [
          {
            "name": "callback",
            "type": "function",
            "parameters": [
              {
                "name": "result",
                "type": "string",
                "description" : "The OOBE timestamp."
              }
            ]
          }
        ]
      },
      {
        "name": "getUserConsent",
        "description": "If device policy allows user to redeem offer, displays a native dialog asking user for a consent to verify device's eligibility for the offer. If the device policy forbids user to redeem offers, displays a native dialog informing user the offer redeeming is disabled.",
        "type": "function",
        "parameters": [
          {
            "name": "consentRequester",
            "description": "Information about the service requesting user consent.",
            "type": "object",
            "properties": {
              "serviceName": {
                "type": "string",
                "minLength": 1,
                "description": "User friendly name of the service that is requesting the consent."
              },
              "origin": {
                "type": "string",
                "description": "URL origin of the service requesting the consent."
              }
            }
          },
          {
            "name": "callback",
            "type": "function",
            "parameters": [
              {
                "name": "result",
                "type": "boolean",
                "description": "Whether the user consent was given."
              }
            ]
          }
        ]
      }
    ]
  }
]