package jp.sourceforge.shovel.form.impl;

import static jp.sourceforge.shovel.AvailabilityType.*;

import org.seasar.struts.annotation.tiger.StrutsActionForm;

import jp.sourceforge.shovel.AvailabilityType;
import jp.sourceforge.shovel.form.IDeviceForm;

@StrutsActionForm(name = "deviceForm")
public class DeviceFormImpl implements IDeviceForm {
    String address_;
    String deviceType_;
    AvailabilityType availabilityType_;
    int phase_;
    
    public String getAddress() {
        return address_ == null ? "" : address_;
    }
    public void setAddress(String address) {
        address_ = address;
    }
    public String getDeviceType() {
        return deviceType_ == null ? "unknown" : deviceType_;
    }
    public void setDeviceType(String deviceType) {
        deviceType_ = deviceType;
    }
    public String getAvailability() {
        return getAvailabilityType().getKey();
    }
    public void setAvailability(String availability) {
        setAvailabilityType(AvailabilityType.find(availability));
    }
    public AvailabilityType getAvailabilityType() {
        return availabilityType_ == null ? ON : availabilityType_;
    }
    void setAvailabilityType(AvailabilityType availabilityType) {
        availabilityType_ = availabilityType;
    }
    public int getPhase() {
        return phase_;
    }
    public void setPhase(int phase) {
        phase_ = phase;
    }
}
