package com.usky.eg.adb;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 服务端调用官方 platform-tools adb（需在 PATH 或可执行路径配置）。
 */
@ConfigurationProperties(prefix = "eg.adb")
public class EgDeviceAdbProperties {

    /**
     * adb 可执行文件名或绝对路径，默认依赖系统 PATH 中的 adb
     */
    private String executable = "adb";

    /**
     * connect / disconnect / tcpip 等命令超时（秒）
     */
    private long commandTimeoutSeconds = 45L;

    /**
     * screencap 超时（秒）
     */
    private long screenshotTimeoutSeconds = 60L;

    /**
     * tcpip 失败时是否先执行一次 adb connect 再重试 tcpip
     */
    private boolean tcpipRetryAfterConnect = true;

    /**
     * 截屏前是否先执行 adb connect（避免仅调 screenshot 时 adb 侧尚无该 serial，报 device not found）
     */
    private boolean screenshotConnectFirst = true;

    public String getExecutable() {
        return executable;
    }

    public void setExecutable(String executable) {
        this.executable = executable;
    }

    public long getCommandTimeoutSeconds() {
        return commandTimeoutSeconds;
    }

    public void setCommandTimeoutSeconds(long commandTimeoutSeconds) {
        this.commandTimeoutSeconds = commandTimeoutSeconds;
    }

    public long getScreenshotTimeoutSeconds() {
        return screenshotTimeoutSeconds;
    }

    public void setScreenshotTimeoutSeconds(long screenshotTimeoutSeconds) {
        this.screenshotTimeoutSeconds = screenshotTimeoutSeconds;
    }

    public boolean isTcpipRetryAfterConnect() {
        return tcpipRetryAfterConnect;
    }

    public void setTcpipRetryAfterConnect(boolean tcpipRetryAfterConnect) {
        this.tcpipRetryAfterConnect = tcpipRetryAfterConnect;
    }

    public boolean isScreenshotConnectFirst() {
        return screenshotConnectFirst;
    }

    public void setScreenshotConnectFirst(boolean screenshotConnectFirst) {
        this.screenshotConnectFirst = screenshotConnectFirst;
    }
}
