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

import com.google.gson.reflect.TypeToken;
import com.suse.saltstack.netapi.calls.LocalCall;

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

/**
 * salt.modules.network
 */
public class Network {

    private Network() { }

    /**
     *
     */
    public static class Interface {
        private String hwaddr;
        private boolean up;
        private List<INet> inet;
        private List<INet6> inet6;
    }

    /**
     *
     */
    public static class INet {
        private String broadcast;
        private String netmask;
        private String label;
        private String address;

    }

    /**
     *
     */
    public static class INet6 {
        private String prefixlen;
        private String address;
    }

    public static LocalCall<Map<String, Map<String, Interface>>> interfaces() {
        return new LocalCall<>("network.interfaces", Optional.empty(), Optional.empty(),
                new TypeToken<Map<String, Map<String, Interface>>>(){});
    }
}

@@ -298,32 +298,87 @@
 %0A%0A    /**%0A     *
+ Network interface as returned by %22network.interfaces%22.
 %0A     */%0A    pub
@@ -406,16 +406,17 @@
 rface %7B%0A
+%0A
         
@@ -534,37 +534,592 @@
  inet6;%0A
-    %7D%0A%0A    /**%0A     *
+%0A        /**%0A         * @return the hwaddr%0A         */%0A        public String getHWAddr() %7B%0A            return hwaddr;%0A        %7D%0A%0A        /**%0A         * @return the up%0A         */%0A        public boolean isUp() %7B%0A            return up;%0A        %7D%0A%0A        /**%0A         * @return the inet%0A         */%0A        public List%3CINet%3E getInet() %7B%0A            return inet;%0A        %7D%0A%0A        /**%0A         * @return the inet6%0A         */%0A        public List%3CINet6%3E getInet6() %7B%0A            return inet6;%0A        %7D%0A    %7D%0A%0A    /**%0A     * Network interface as returned by %22network.interfaces%22.
 %0A     */
@@ -1150,16 +1150,17 @@
  INet %7B%0A
+%0A
         
@@ -1284,33 +1284,618 @@
 s;%0A%0A    
-%7D%0A%0A    /**%0A     *
+    /**%0A         * @return the broadcast%0A         */%0A        public String getBroadcast() %7B%0A            return broadcast;%0A        %7D%0A%0A        /**%0A         * @return the netmask%0A         */%0A        public String getNetmask() %7B%0A            return netmask;%0A        %7D%0A%0A        /**%0A         * @return the label%0A         */%0A        public String getLabel() %7B%0A            return label;%0A        %7D%0A%0A        /**%0A         * @return the address%0A         */%0A        public String getAddress() %7B%0A            return address;%0A        %7D%0A    %7D%0A%0A    /**%0A     * Network interface (IPv6) as returned by %22network.interfaces%22.
 %0A     */
@@ -1927,16 +1927,17 @@
 INet6 %7B%0A
+%0A
         
@@ -1989,24 +1989,292 @@
 ing address;
+%0A%0A        /**%0A         * @return the prefixlen%0A         */%0A        public String getPrefixlen() %7B%0A            return prefixlen;%0A        %7D%0A%0A        /**%0A         * @return the address%0A         */%0A        public String getAddress() %7B%0A            return address;%0A        %7D
 %0A    %7D%0A%0A    

Add getters allowing to work with network interfaces