package cn.iocoder.yudao.module.remote.config.ip;


import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.Cockpit;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@ConfigurationProperties(prefix ="remote",ignoreInvalidFields = true)
@Getter
@Setter
public class IpProperties {

    private List<Cockpit> cockpit;

    public Cockpit getCockpitByIp(String ip) {
        for (Cockpit v : cockpit) {
            if (ip.equals(v.getIpcIp())){
                return v;
            }
        }
        Cockpit data = new Cockpit();
        data.setControllerIp("127.0.0.1");
        data.setControllerPort(9000);
        return data;
    }
}
