package com.lingniu.ingest.protocol.jt1078.config;

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

@ConfigurationProperties(prefix = "lingniu.ingest.jt1078")
public class Jt1078Properties {

    /** 是否启用 JT/T 1078 音视频能力；它不参与 32960 快照/历史字段查询。 */
    private boolean enabled = false;
    private MediaStream mediaStream = new MediaStream();

    public boolean isEnabled() { return enabled; }
    public void setEnabled(boolean enabled) { this.enabled = enabled; }
    public MediaStream getMediaStream() { return mediaStream; }
    public void setMediaStream(MediaStream mediaStream) { this.mediaStream = mediaStream; }

    public static class MediaStream {
        /** 媒体流子模块开关，便于只启用信令、不落媒体文件。 */
        private boolean enabled = true;
        /** TCP 媒体流监听，适合生产默认路径。 */
        private boolean tcpEnabled = true;
        /** UDP 媒体流监听默认关闭，开启前需要确认网络和包乱序处理能力。 */
        private boolean udpEnabled = false;
        private int port = 11078;
        private int udpPort = 11078;
        private int workerThreads = 0;
        /** 单包最大长度保护，防止异常媒体流耗尽内存。 */
        private int maxPacketLength = 1024 * 1024;
        /** 媒体文件分段秒数，影响归档文件粒度。 */
        private int segmentSeconds = 300;

        public boolean isEnabled() { return enabled; }
        public void setEnabled(boolean enabled) { this.enabled = enabled; }
        public boolean isTcpEnabled() { return tcpEnabled; }
        public void setTcpEnabled(boolean tcpEnabled) { this.tcpEnabled = tcpEnabled; }
        public boolean isUdpEnabled() { return udpEnabled; }
        public void setUdpEnabled(boolean udpEnabled) { this.udpEnabled = udpEnabled; }
        public int getPort() { return port; }
        public void setPort(int port) { this.port = port; }
        public int getUdpPort() { return udpPort; }
        public void setUdpPort(int udpPort) { this.udpPort = udpPort; }
        public int getWorkerThreads() { return workerThreads; }
        public void setWorkerThreads(int workerThreads) { this.workerThreads = workerThreads; }
        public int getMaxPacketLength() { return maxPacketLength; }
        public void setMaxPacketLength(int maxPacketLength) { this.maxPacketLength = maxPacketLength; }
        public int getSegmentSeconds() { return segmentSeconds; }
        public void setSegmentSeconds(int segmentSeconds) { this.segmentSeconds = segmentSeconds; }
    }
}
