package com.luticate.auth.dbo;

import com.luticate.utils.dbo.LuDbo;
import com.luticate.utils.dbo.LuMultipleDbo;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;

/**
 *
 * Created by robin on 11/27/15.
 */
public class LuPermissionDbo extends LuDbo {

    public static class LuMultiplePermissionDbo extends LuMultipleDbo<LuPermissionDbo> {

    }

    private String _name;

    private boolean _value;

    public String getName() {
        return _name;
    }

    public void setName(String name) {
        _name = name;
    }

    public boolean getValue() {
        return _value;
    }

    public void setValue(boolean value) {
        _value = value;
    }

    @Override
    public void fromJson(JSONObject json) throws JSONException {
        _name = json.getString("Name");
        _value = json.getBoolean("Value");
    }

    @Override
    public HashMap<String, Object> toArray() {
        HashMap<String, Object> array = new HashMap<>();
        array.put("Name", _name);
        array.put("Value", _value);
        return array;
    }
}
