package cn.skcks.docking.gb28181.wvp.config;

import cn.skcks.docking.gb28181.config.sip.SipConfig;
import cn.skcks.docking.gb28181.core.sip.gb28181.sdp.StreamMode;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.sip.ListeningPoint;
import java.util.List;

@Component
@ConfigurationProperties(prefix = "proxy.gb28181.sip", ignoreInvalidFields = true)
@Order(0)
@Data
public class ProxySipConfig {
    private List<String> ip;

    private List<String> showIp;

    private Integer port;

    private String domain;

    private String id;

    private String password;

    private String transport = ListeningPoint.UDP;

    private StreamMode streamMode = StreamMode.TCP_PASSIVE;

    /**
     * 某些特殊情况下 使用 视频回放点播 代替 下载
     */
    private boolean usePlaybackToDownload = false;

    @Bean
    public SipConfig sipConfig(){
        SipConfig sipConfig = new SipConfig();
        sipConfig.setIp(ip);
        sipConfig.setShowIp(showIp);
        sipConfig.setPort(port);
        sipConfig.setDomain(domain);
        sipConfig.setId(id);
        sipConfig.setPassword(password);
        return sipConfig;

    }
}
