/*******************************************************************************
 * Copyright (c) 2024-2025 R3944Realms. All rights reserved.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 *     http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.r3944realms.dg_lab.websocket.sharedData;

import com.r3944realms.dg_lab.utils.stringUtils.StringHandlerUtil;
import com.r3944realms.dg_lab.api.websocket.sharedData.ISharedData;

import java.util.Timer;

/**
 * 客户端PowerBox共享数据
 */
public class ClientPowerBoxSharedData implements ISharedData {
    @SuppressWarnings("MethodDoesntCallSuperMethod")
    @Override
    public ClientPowerBoxSharedData clone() {
        ClientPowerBoxSharedData clone = new ClientPowerBoxSharedData();
        clone.connectionId = connectionId;
        clone.targetWSId = targetWSId;
        clone.delay = delay;
        clone.address = address;
        clone.port = port;
        return clone;
    }

    /**
     * The Connection id.
     */
    public String connectionId = "",
    /**
     * The Target ws id.
     */
    targetWSId = "";
    /**
     * The Delay.
     */
    public int delay = 500; //防抖
    /**
     * The Delay timer.
     */
    public Timer delayTimer;
    /**
     * The Address.
     */
    public String address;
    /**
     * The Port.
     */
    public int port;
    /**
     * The Follow a strength.
     */
//跟随AB的软上限
    public final boolean followAStrength = false;
    /**
     * The Follow b strength.
     */
    public final boolean followBStrength = false;

    /**
     * Instantiates a new Client power box shared data.
     *
     * @param delay the delay
     */
    public ClientPowerBoxSharedData(int delay) {
        this.delay = delay > 0 ? delay : 500;
    }

    /**
     * Instantiates a new Client power box shared data.
     */
    public ClientPowerBoxSharedData() {}

    /**
     * Gets url.
     *
     * @return the url
     */
    public String getUrl() {
        return StringHandlerUtil.buildWebSocketURL(address, port, false);
    }


}
