package com.suse.salt.netapi.calls.modules;

import com.suse.salt.netapi.calls.LocalCall;

import com.google.gson.reflect.TypeToken;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * salt.modules.state
 */
public class State {

    private State() { }

    public static LocalCall<Map<String, Object>> apply(List<String> mods) {
        LinkedHashMap<String, Object> args = new LinkedHashMap<>();
        args.put("mods", mods);
        return new LocalCall<>("state.apply", Optional.empty(), Optional.of(args),
                new TypeToken<Map<String, Object>>() { });
    }

    public static LocalCall<Map<String, Object>> apply(String... mods) {
        return apply(Arrays.asList(mods));
    }

}

@@ -152,16 +152,46 @@
 Arrays;%0A
+import java.util.Collections;%0A
 import j
@@ -812,10 +812,608 @@
 %0A    %7D%0A%0A
+    public static LocalCall%3CMap%3CString, Object%3E%3E apply(String mod,%0A            Map%3CString, Object%3E pillar) %7B%0A        LinkedHashMap args = new LinkedHashMap();%0A        args.put(%22mods%22, Collections.singletonList(mod));%0A        args.put(%22pillar%22, pillar);%0A        return new LocalCall(%22state.apply%22, Optional.empty(), Optional.of(args),%0A                new TypeToken%3CMap%3CString, Object%3E%3E() %7B %7D);%0A    %7D%0A%0A    public static LocalCall%3CObject%3E showHighstate() %7B%0A        return new LocalCall%3C%3E(%22state.show_highstate%22, Optional.empty(), Optional.empty(),%0A                new TypeToken%3CObject%3E() %7B %7D);%0A    %7D%0A%0A
 %7D%0A

apply state with pillar data and show_highstate