/*
 * Copyright 2014-2017 Red Hat, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.hawkular.inventory.model;

import static com.fasterxml.jackson.annotation.JsonInclude.*;

import java.io.Serializable;
import java.util.Collections;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * @author Joel Takvorian
 */
public class Operation implements Serializable {

    @JsonInclude(Include.NON_NULL)
    private final String name;    // Ex: "Shutdown"

    @JsonInclude(Include.NON_NULL)
    private final Map<String, Map<String, String>> parameterTypes;  // Ex: "restart" => {"type": "bool", "description": "If true, blablabla", "required": false}

    public Operation(@JsonProperty("name") String name,
                     @JsonProperty("parameterTypes") Map<String, Map<String, String>> parameterTypes) {
        this.name = name;
        this.parameterTypes = parameterTypes;
    }

    public String getName() {
        return name;
    }

    public Map<String, Map<String, String>> getParameterTypes() {
        return parameterTypes != null ? Collections.unmodifiableMap(parameterTypes) : Collections.EMPTY_MAP;
    }
}

@@ -1235,20 +1235,16 @@
 arameter
-Type
 s;  // E
@@ -1434,20 +1434,16 @@
 arameter
-Type
 s%22) Map%3C
@@ -1480,20 +1480,16 @@
 arameter
-Type
 s) %7B%0A   
@@ -1533,20 +1533,16 @@
 arameter
-Type
 s = para
@@ -1546,20 +1546,16 @@
 arameter
-Type
 s;%0A    %7D
@@ -1670,20 +1670,16 @@
 arameter
-Type
 s() %7B%0A  
@@ -1700,20 +1700,16 @@
 arameter
-Type
 s != nul
@@ -1753,12 +1753,8 @@
 eter
-Type
 s) :

rename Operation.parameterTypes => parameters