1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/// Info about a binary system:
/// * `name` -- Name of binary system.
/// * `period` -- Period of the orbit.
/// * `epoch_peri` -- Epoch of the perihelion.
/// * `long_peri` -- Longitude of the perihelion.
/// * `ecc` -- Eccentricity of the orbit.
/// * `axis` -- Semi-major axis of the orbit.
/// * `incl` -- Orbital inclination.
/// * `pa_node` -- Position angle of the ascending node.
pub struct BinaryInfo {
    pub name: String,
    pub period: f64,
    pub epoch_peri: f64,
    pub long_peri: f64,
    pub ecc: f64,
    pub axis: f64,
    pub incl: f64,
    pub pa_node: f64,
}

/// Retrieve info about a binary system.
///
/// ## Returns
/// * BinaryInfo structure
/// * status
pub fn get_binary_info_vector(binary_name: String) -> (BinaryInfo, String) {
    let mut binary_info_vector: Vec<BinaryInfo> = Vec::new();

    binary_info_vector.push(BinaryInfo {
        name: "eta-Cor".to_string(),
        period: 41.623,
        epoch_peri: 1934.008,
        long_peri: 219.907,
        ecc: 0.2763,
        axis: 0.907,
        incl: 59.025,
        pa_node: 23.717,
    });

    binary_info_vector.push(BinaryInfo {
        name: "gamma-Vir".to_string(),
        period: 171.37,
        epoch_peri: 1836.433,
        long_peri: 252.88,
        ecc: 0.8808,
        axis: 3.746,
        incl: 146.05,
        pa_node: 31.78,
    });

    binary_info_vector.push(BinaryInfo {
        name: "eta-Cas".to_string(),
        period: 480.0,
        epoch_peri: 1889.6,
        long_peri: 268.59,
        ecc: 0.497,
        axis: 11.9939,
        incl: 34.76,
        pa_node: 278.42,
    });

    binary_info_vector.push(BinaryInfo {
        name: "zeta-Ori".to_string(),
        period: 1508.6,
        epoch_peri: 2070.6,
        long_peri: 47.3,
        ecc: 0.07,
        axis: 2.728,
        incl: 72.0,
        pa_node: 155.5,
    });

    binary_info_vector.push(BinaryInfo {
        name: "alpha-CMa".to_string(),
        period: 50.09,
        epoch_peri: 1894.13,
        long_peri: 147.27,
        ecc: 0.5923,
        axis: 7.5,
        incl: 136.53,
        pa_node: 44.57,
    });

    binary_info_vector.push(BinaryInfo {
        name: "delta-Gem".to_string(),
        period: 1200.0,
        epoch_peri: 1437.0,
        long_peri: 57.19,
        ecc: 0.11,
        axis: 6.9753,
        incl: 63.28,
        pa_node: 18.38,
    });

    binary_info_vector.push(BinaryInfo {
        name: "alpha-Gem".to_string(),
        period: 420.07,
        epoch_peri: 1965.3,
        long_peri: 261.43,
        ecc: 0.33,
        axis: 6.295,
        incl: 115.94,
        pa_node: 40.47,
    });

    binary_info_vector.push(BinaryInfo {
        name: "aplah-CMi".to_string(),
        period: 40.65,
        epoch_peri: 1927.6,
        long_peri: 269.8,
        ecc: 0.4,
        axis: 4.548,
        incl: 35.7,
        pa_node: 284.3,
    });

    binary_info_vector.push(BinaryInfo {
        name: "alpha-Cen".to_string(),
        period: 79.92,
        epoch_peri: 1955.56,
        long_peri: 231.56,
        ecc: 0.516,
        axis: 17.583,
        incl: 79.24,
        pa_node: 204.868,
    });

    binary_info_vector.push(BinaryInfo {
        name: "alpha Sco".to_string(),
        period: 900.0,
        epoch_peri: 1889.0,
        long_peri: 0.0,
        ecc: 0.0,
        axis: 3.21,
        incl: 86.3,
        pa_node: 273.0,
    });

    for i in binary_info_vector {
        if i.name == binary_name {
            return (i, "OK".to_string());
        }
    }

    return (
        BinaryInfo {
            name: binary_name,
            period: 0.0,
            epoch_peri: 0.0,
            long_peri: 0.0,
            ecc: 0.0,
            axis: 0.0,
            incl: 0.0,
            pa_node: 0.0,
        },
        "NotFound".to_string(),
    );
}