package net.northking.cctp.upperComputer.driver.agent.command;

import net.northking.cctp.upperComputer.driver.agent.command.protocol.AbstractProtocolCommand;

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

public class RotationScreenCommand extends AbstractProtocolCommand<Object> {

    private Rotation rotation = Rotation.ROTATION_0;

    public RotationScreenCommand(Rotation rotation) {
        this.rotation = rotation;
    }

    public Rotation getRotation() {
        return rotation;
    }

    public void setRotation(Rotation rotation) {
        this.rotation = rotation;
    }

    @Override
    public int getCommandId() {
        return 25;
    }

    @Override
    public void doSend(DataOutput output) throws IOException {
        switch (rotation) {
            case ROTATION_0:
                output.writeInt(0);
                break;
            case ROTATION_90:
                output.writeInt(1);
                break;
            case ROTATION_180:
                output.writeInt(2);
                break;
            case ROTATION_270:
                output.writeInt(3);
                break;
        }
    }

    @Override
    public Object buildReceive(DataInput input) throws IOException {
        return null;
    }

    public enum Rotation {
        ROTATION_0,
        ROTATION_90,
        ROTATION_180,
        ROTATION_270
    }
}
