/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.104.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SubmitPhoneNumberKycRequest {
#[serde(rename = "profileId")]
pub profile_id: String,
#[serde(rename = "country")]
pub country: String,
/// Idempotency token for this submission attempt. Once the number has been ordered, a retry with the same token returns that same number instead of ordering another. A submission that fails before the number is ordered releases the token, so you can correct your details and re-submit with it. Omit it and every call provisions a new number.
#[serde(rename = "submissionId", skip_serializing_if = "Option::is_none")]
pub submission_id: Option<String>,
/// Provision several same-country numbers from one submission (1-5). The single verification covers all of them; each number is billed only when it activates. Numbers that fail to order are skipped (best-effort). With `areaCode`, a quantity above that area's live stock is rejected with a 400.
#[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
pub quantity: Option<i32>,
/// Reuse a prior approved verification for this country (skips document/field collection; places the order immediately).
#[serde(rename = "reuse", skip_serializing_if = "Option::is_none")]
pub reuse: Option<bool>,
/// Which reusable verification to use (GET reusable.options[].id). The unambiguous selection key. Omitted = the approved default. No match = 409.
#[serde(rename = "reuseOptionId", skip_serializing_if = "Option::is_none")]
pub reuse_option_id: Option<String>,
/// Legacy fallback for `reuseOptionId`: the source phone number (GET reusable.options[].fromPhoneNumber). Ambiguous when a number labels two verifications, so prefer `reuseOptionId`. Omitted = the approved default. No match = 409.
#[serde(rename = "reuseFrom", skip_serializing_if = "Option::is_none")]
pub reuse_from: Option<String>,
/// Area code (NDC) the number must be in. Hard constraint: an empty area pool fails with 409 code AREA_CODE_UNAVAILABLE instead of ordering from another area. Omit for any area. Options come from GET /v1/phone-numbers/availability (areaOptions); the purchase 202 kycUrl echoes the areaCode picked at purchase time so it can be passed here.
#[serde(rename = "areaCode", skip_serializing_if = "Option::is_none")]
pub area_code: Option<String>,
/// With areaCode: pre-order that area when it has no stock (an area listed in soldOutAreas with preOrderable true) instead of failing with AREA_CODE_UNAVAILABLE. The carrier sources a number in that area.
#[serde(rename = "preOrder", skip_serializing_if = "Option::is_none")]
pub pre_order: Option<bool>,
/// End user's legal first name. Required when the country has an action/ID-verification (Onfido) requirement.
#[serde(rename = "endUserFirstName", skip_serializing_if = "Option::is_none")]
pub end_user_first_name: Option<String>,
/// End user's legal last name. Same condition as endUserFirstName.
#[serde(rename = "endUserLastName", skip_serializing_if = "Option::is_none")]
pub end_user_last_name: Option<String>,
/// requirementId → textual value
#[serde(rename = "values", skip_serializing_if = "Option::is_none")]
pub values: Option<std::collections::HashMap<String, String>>,
/// One per document requirement. Each is EITHER inline base64 OR a `documentId` returned by POST /v1/phone-numbers/kyc/upload-document (use the upload endpoint for large files to stay under the request-size limit).
#[serde(rename = "documents", skip_serializing_if = "Option::is_none")]
pub documents: Option<Vec<models::SubmitPhoneNumberKycRequestDocumentsInner>>,
#[serde(rename = "address", skip_serializing_if = "Option::is_none")]
pub address: Option<Box<models::SubmitPhoneNumberKycRequestAddress>>,
}
impl SubmitPhoneNumberKycRequest {
pub fn new(profile_id: String, country: String) -> SubmitPhoneNumberKycRequest {
SubmitPhoneNumberKycRequest {
profile_id,
country,
submission_id: None,
quantity: None,
reuse: None,
reuse_option_id: None,
reuse_from: None,
area_code: None,
pre_order: None,
end_user_first_name: None,
end_user_last_name: None,
values: None,
documents: None,
address: None,
}
}
}