package com.gyee.edge.protocol.iec60870.infoelement;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * Represents a qualifier of parameter activation (QPA) information element.
 */
public class IeQualifierOfParameterActivation extends InformationElement {

    private final int value;

    public IeQualifierOfParameterActivation(int value) {
        this.value = value;
    }

    static IeQualifierOfParameterActivation decode(DataInputStream is) throws IOException {
        return new IeQualifierOfParameterActivation(is.readUnsignedByte());
    }

    @Override
    int encode(byte[] buffer, int i) {
        buffer[i] = (byte) value;
        return 1;
    }

    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return "Qualifier of parameter activation: " + value;
    }
}
