package net.northking.cctp.upperComputer.driver.ios.command.data;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class TypeKeysUiNodeData extends TextData {


    public Integer frequency = null;

    public Integer getFrequency() {
        return frequency;
    }

    public void setFrequency(Integer frequency) {
        this.frequency = frequency;
    }

    @Override
    public void buildFromInput(DataInput dataInput) throws IOException {
        super.buildFromInput(dataInput);
        boolean hasFrequency = dataInput.readBoolean();
        if (hasFrequency) {
            frequency = dataInput.readInt();
        }
    }

    @Override
    public void encodeToOutput(DataOutput dataOutput) throws IOException {
        super.encodeToOutput(dataOutput);
        dataOutput.writeBoolean(frequency !=null);
        if (frequency !=null) {
            dataOutput.writeInt(frequency);
        }
    }

    @Override
    public String toString() {
        return "TypeKeysUiNodeData{" +
                "frequency=" + frequency +
                ", text='" + text + '\'' +
                '}';
    }
}
