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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
use crate::types::passport;

/// Represents different kinds of [`Element`].
///
/// [`Element`]: ./struct.Element.html
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
// todo: #[non_exhaustive]
pub enum Kind {
    /// THe user's personal details.
    PersonalDetails(String),
    /// The user's passport.
    // todo: #[non_exhaustive]
    Passport {
        /// Data related to the passport.
        data: String,
        /// The front size of the passport.
        front_side: passport::File,
        /// The user's selfie with the passport.
        selfie: passport::File,
        /// Translated versions of the passport.
        translation: Vec<passport::File>,
    },
    /// The user's driver license.
    // todo: #[non_exhaustive]
    DriverLicense {
        /// Data related to the license.
        data: String,
        /// The front side of the license.
        front_side: passport::File,
        /// The reverse side of the license.
        reverse_side: passport::File,
        /// The user's selfie with the license.
        selfie: passport::File,
        /// Translated versions of the license.
        translation: Vec<passport::File>,
    },
    /// The user's identity card.
    // todo: #[non_exhaustive]
    IdentityCard {
        /// Data related to the identity card.
        data: String,
        /// The front side of the identity card.
        front_side: passport::File,
        /// The reverse side of the identity card.
        reverse_side: passport::File,
        /// The user's selfie with the license.
        selfie: passport::File,
        /// Translated versions of the identity card.
        translation: Vec<passport::File>,
    },
    /// The user's internal passport.
    // todo: #[non_exhaustive]
    InternalPassport {
        /// Data related to the passport.
        data: String,
        /// The front side of the passport.
        front_side: passport::File,
        /// The user's selfie with the passport.
        selfie: passport::File,
        /// Translated versions of the passport.
        translation: Vec<passport::File>,
    },
    /// The user's address.
    Address(String),
    /// The user's utility bill.
    // todo: #[non_exhaustive]
    UtilityBill {
        /// Photos of the bill.
        files: Vec<passport::File>,
        /// Translated versions of the bill.
        translation: Vec<passport::File>,
    },
    /// The user's bank statement.
    // todo: #[non_exhaustive]
    BankStatement {
        /// Photos of the statement.
        files: Vec<passport::File>,
        /// Translated versions of the statement.
        translation: Vec<passport::File>,
    },
    /// The user's rental agreement.
    // todo: #[non_exhaustive]
    RentalAgreement {
        /// Photos of the agreement.
        files: Vec<passport::File>,
        /// Translated versions of the agreement.
        translation: Vec<passport::File>,
    },
    /// The user's passport registration.
    // todo: #[non_exhaustive]
    PassportRegistration {
        /// Photos of the registration.
        files: Vec<passport::File>,
        /// Translated versions of the registration.
        translation: Vec<passport::File>,
    },
    /// The user's temporary registration.
    // todo: #[non_exhaustive]
    TemporaryRegistration {
        /// Photos of the registration.
        files: Vec<passport::File>,
        /// Translated versions of the registration.
        translation: Vec<passport::File>,
    },
    /// The user's phone number.
    PhoneNumber(String),
    /// The user's email.
    Email(String),
}

impl Kind {
    /// Checks if `self` is `PersonalDetails`.
    pub fn is_personal_details(&self) -> bool {
        match self {
            Kind::PersonalDetails(..) => true,
            _ => false,
        }
    }

    /// Checks if `self` is `Passport`.
    pub fn is_passport(&self) -> bool {
        match self {
            Kind::Passport { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `DriverLicense`.
    pub fn is_driver_license(&self) -> bool {
        match self {
            Kind::DriverLicense { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `IdentityCard`.
    pub fn is_identity_card(&self) -> bool {
        match self {
            Kind::IdentityCard { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `InternalPassport`.
    pub fn is_internal_passport(&self) -> bool {
        match self {
            Kind::InternalPassport { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `Address`.
    pub fn is_address(&self) -> bool {
        match self {
            Kind::Address(..) => true,
            _ => false,
        }
    }

    /// Checks if `self` is `UtilityBill`.
    pub fn is_utility_bill(&self) -> bool {
        match self {
            Kind::UtilityBill { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `BankStatement`.
    pub fn is_bank_statement(&self) -> bool {
        match self {
            Kind::BankStatement { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `RentalAgreement`.
    pub fn is_rental_agreement(&self) -> bool {
        match self {
            Kind::RentalAgreement { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `PassportRegistration`.
    pub fn is_passport_registration(&self) -> bool {
        match self {
            Kind::PassportRegistration { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `TemporaryRegistration`.
    pub fn is_temporary_registration(&self) -> bool {
        match self {
            Kind::TemporaryRegistration { .. } => true,
            _ => false,
        }
    }

    /// Checks if `self` is `PhoneNumber`.
    pub fn is_phone_number(&self) -> bool {
        match self {
            Kind::PhoneNumber(..) => true,
            _ => false,
        }
    }

    /// Checks if `self` is `Email`.
    pub fn is_email(&self) -> bool {
        match self {
            Kind::Email(..) => true,
            _ => false,
        }
    }
}