package com.zehong.framework.config;

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

/**
 * @author lenovo
 * @date 2025/7/31
 * @description Netty配置类
 */
@Component
@ConfigurationProperties(prefix = "netty")
public class NettyConfig {

    /**
     * 服务端口
     */
    private int port = 6001;

    /**
     * 主线程数
     */
    private int bossGroupThreadCount = 1;

    /**
     * 工作线程数
     */
    private int workerGroupThreadCount = Runtime.getRuntime().availableProcessors() * 2;

    /**
     * 最大帧长度
     */
    private int maxFrameLength = 65535;

    /**
     * 心跳检测超时时间(秒)
     */
    private int heartbeatTimeout = 60;

    // getter和setter方法
    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getBossGroupThreadCount() {
        return bossGroupThreadCount;
    }

    public void setBossGroupThreadCount(int bossGroupThreadCount) {
        this.bossGroupThreadCount = bossGroupThreadCount;
    }

    public int getWorkerGroupThreadCount() {
        return workerGroupThreadCount;
    }

    public void setWorkerGroupThreadCount(int workerGroupThreadCount) {
        this.workerGroupThreadCount = workerGroupThreadCount;
    }

    public int getMaxFrameLength() {
        return maxFrameLength;
    }

    public void setMaxFrameLength(int maxFrameLength) {
        this.maxFrameLength = maxFrameLength;
    }

    public int getHeartbeatTimeout() {
        return heartbeatTimeout;
    }

    public void setHeartbeatTimeout(int heartbeatTimeout) {
        this.heartbeatTimeout = heartbeatTimeout;
    }
}
