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 ScreenStreamCommand extends AbstractProtocolCommand<Object> {

    /**
     * 是否启动
     */
    private boolean start = true;

    /**
     * 屏幕方向：0/1/2/3 （0°，90°，180°，270°）
     */
    private int rotation = 0;

    /**
     * 宽度
     */
    private int width = 1080;

    /**
     * 高度
     */
    private int height = 1920;

    /**
     * 帧率
     */
    private float frameRate = 30.f;

    /**
     * 质量，1-100
     */
    private int quality = 75;

    public ScreenStreamCommand(boolean start, int rotation, int width, int height, float frameRate, int quality) {
        this.start = start;
        this.rotation = rotation;
        this.width = width;
        this.height = height;
        this.frameRate = frameRate;
        this.quality = quality;
    }

    public boolean isStart() {
        return start;
    }

    public void setStart(boolean start) {
        this.start = start;
    }

    public int getRotation() {
        return rotation;
    }

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

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public float getFrameRate() {
        return frameRate;
    }

    public void setFrameRate(float frameRate) {
        this.frameRate = frameRate;
    }

    public int getQuality() {
        return quality;
    }

    public void setQuality(int quality) {
        this.quality = quality;
    }

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

    @Override
    public void doSend(DataOutput output) throws IOException {
        output.writeBoolean(start);
        output.writeInt(rotation);
        output.writeInt(width);
        output.writeInt(height);
        output.writeFloat(frameRate);
        output.writeInt(quality);
    }

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