/**************************************************************************************************
 * Copyright 2018 Qualcomm Technologies International, Ltd.                                       *
 **************************************************************************************************/

{% if "iotsys" in swagger_data.type %}
package com.qualcomm.qti.iotcontrollersdk.iotsys.resource.clients;
{% endif %}

{% if "allplay" in swagger_data.type %}
package com.qualcomm.qti.iotcontrollersdk.allplay.resource.clients;
{% endif %}

import java.util.List;
import java.util.ArrayList;

import org.iotivity.base.OcException;
import org.iotivity.base.OcResource;

import com.qualcomm.qti.iotcontrollersdk.controller.IoTBaseResourceClient;

public class {{swagger_data.name|class_name_syntax}}ResourceClient extends IoTBaseResourceClient {

    private {{swagger_data.name|class_name_syntax}}ResourceClient() {
    }

    public {{swagger_data.name|class_name_syntax}}ResourceClient(String host) throws OcException {
        super(host);
        construct();
    }

    public OcResource construct() throws OcException {
        List<String> interfacesList= new ArrayList<>();
{% for iface in swagger_data.ifaces.split(',') %}
        interfacesList.add({{iface}});
{% endfor %}

        List<String> typeList= new ArrayList<>();
{% for type in swagger_data.type.split(',') %}
        typeList.add({{type}});
{% endfor %}

        return super.construct(mHost, "{{swagger_data.uri}}",
                        typeList,
                        interfacesList,
                        isObserveSupported());
    }

    @Override
    public boolean isGetSupported() {
{% if 'get' in swagger_data.crud %}
        return true;
{% else %}
        return false;
{% endif %}
    }

    @Override
    public boolean isPostSupported() {
{% if 'post' in swagger_data.crud %}
        return true;
{% else %}
        return false;
{% endif %}
    }

    @Override
    public boolean isObserveSupported() {
{% if swagger_data.prop != 0 %}
        return true;
{% else %}
        return false;
{% endif %}
    }

}