package org.iotivity.bridge.homeserver.model;

import org.iotivity.OCEndpoint;

public class Light {

    // Device : oic.d.light
    public static final String DT_LIGHT = "oic.d.light";
    // Resources of Device : oic.r.switch.binary, oic.r.light.dimming, oic.r.colour.colourtemperature, oic.r.energy.consumption
    public static final String RT_BINARYSWITCH = "oic.r.switch.binary";             // required
    public static final String RT_DIMMING = "oic.r.light.dimming";                  // optional
    public static final String RT_COLORTEMP = "oic.r.colour.colourtemperature";     // optional
    public static final String RT_ENERGY = "oic.r.energy.consumption";              // optional

    public static final String URI_LIGHT = "/light" ;
    public static final String URI_DIMMING = "/dimming" ;
    public static final String URI_COLORTMEP = "/ColourTemperatureResURI" ;
    public static final String URI_ENERGY = "/EnergyConsumptionResURI" ;

    // Properties of resource name
    static public final String RESOURCE_NAME_KEY = "n" ;  // optional

    public static final String RESOURCE_NAME_SWITCH = "Light Switch";  // Switch Binary resource Name
    public static final String RESOURCE_NAME_DIMMING = "Dimming Control";  // Dimming resource Name
    public static final String RESOURCE_NAME_COLORTMEP = "Color Temperature";  // Color Temperature resource Name
    public static final String RESOURCE_NAME_ENERGY = "Energy Consumption";  // Energy Consumption resource Name

    // Properties of BinarySwitch Resource(oic.r.switch.binary)
    public static final String SWITCH_KEY = "value";    // required
    // Properties of Dimming Resource(oic.r.light.dimming)
    public static final String DIMMING_SETTING_KEY = "dimmingSetting"; // required
    public static final String DIMMING_STEP_KEY = "step" ;  // optional, default 5
    public static final String DIMMING_RANGE_KEY = "range" ; // optional, default [0, 100]

    // Properties of Color Temperature Resource(oic.r.colour.colourtemperature)
    public static final String CT_KEY = "ct"; // required
    public static final String CT_STEP_KEY = "step" ;  // optional, default 5
    public static final String CT_RANGE_KEY = "range" ; // optional, default [0, 1000] (?)

    // Properties of Color Temperature Resource(oic.r.colour.colourtemperature)
    public static final String ENERGY_KEY = "energy"; // required
    public static final String POWER_KEY = "power" ;  // required

    private String device_name;

    // Light Switch
    private boolean switch_value = false;   // default switch value : false
    // Dimming Control
    private int dimming_level = 30 ;        // default dimming level : 30
    private int dimming_range = 100;        // dimming range : 0 ~ 99
    private int dimming_step = 10;          // dimming step : 10
    // Color Temperature
    private int ct_value = 457 ;
    private int ct_range = 1000 ;
    private int ct_step = 1 ;
    // Energy Consumption
    private double power = 20.0 ;
    private double energy = 350.4 ;

    public Light() {

        this.device_name = "Light";
    }

    public Light(String device_name) {
        this.device_name = device_name;
    }
    public String getDeviceName() {
        return device_name;
    }
    public void setDeviceName(String name) {
        device_name = name ;
    }


    public boolean isSwitchOn() {
        return switch_value;
    }
    public void setSwitchOn(boolean on) {
        this.switch_value = on;
    }

    public int getDimmingLevel() {
        return dimming_level;
    }
    public void setDimmingLevel(int dimming) {
        this.dimming_level = dimming;
    }

    public int getDimmingStep() {
        return dimming_step;
    }
    public void setDimmingStep(int step) {
        this.dimming_step = step;
    }

    public int getDimmingRange() {
        return dimming_range;
    }
    public void setDimmingRange(int range) {
        this.dimming_range = range;
    }

    public int getColorTemperature() {
        return ct_value;
    }
    public void setColorTemperature(int ct) {
        this.ct_value = ct;
    }

    public int getCTStep() {
        return ct_step;
    }
    public void setCTStep(int ct_step) {
        this.ct_step = ct_step;
    }

    public int getCTRange() {
        return ct_range;
    }
    public void setCTRange(int ct_range) {
        this.ct_range = ct_range;
    }

    public double getPower() {
        return power;
    }
    public void setPower(double current_power) {
        this.power = current_power;
    }

    public double getEnergy() {
        return energy;
    }
    public void setEnergy(double calulated_energy) {
        this.energy = calulated_energy;
    }

}
