package com.rthoni.camotion.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 12/3/15.
 */
public class CameraDbo extends LuDbo {

    private int _id;

    private String _name;

    private String _description;

    public String getDescription() {
        return _description;
    }

    public void setDescription(String description) {
        _description = description;
    }

    public String getName() {
        return _name;
    }

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

    public int getId() {
        return _id;
    }

    public void setId(int id) {
        _id = id;
    }

    public static class MultipleCameraDbo extends LuMultipleDbo<CameraDbo> {
    }

    @Override
    public void fromJson(JSONObject json) throws JSONException {
        _id = json.getInt("Id");
        _description = json.getString("Description");
        _name = json.getString("Name");
    }

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