/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// BulkUploadResult : Result of a CSV bulk upload. The same shape is returned for `200` (all rows succeeded or all failed) and `207` (mixed). Per-row outcomes live in `results`; the row's success is `ok`, and failures carry machine-readable codes in `errors`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BulkUploadResult {
    /// Number of data rows processed from the CSV
    #[serde(rename = "total", skip_serializing_if = "Option::is_none")]
    pub total: Option<i32>,
    /// Count of rows that succeeded (results[].ok === true)
    #[serde(rename = "valid", skip_serializing_if = "Option::is_none")]
    pub valid: Option<i32>,
    /// Count of rows that failed (total - valid)
    #[serde(rename = "invalid", skip_serializing_if = "Option::is_none")]
    pub invalid: Option<i32>,
    /// One entry per CSV data row, in row order.
    #[serde(rename = "results", skip_serializing_if = "Option::is_none")]
    pub results: Option<Vec<models::BulkUploadResultResultsInner>>,
    /// Top-level advisory warnings (e.g. `rows_exceed_advisory_limit:500`). Empty when none.
    #[serde(rename = "warnings", skip_serializing_if = "Option::is_none")]
    pub warnings: Option<Vec<String>>,
    /// Present only when one or more rows targeted an account currently in cooldown. Lets callers map `rate_limited:*` row errors back to structured metadata without parsing the error strings.
    #[serde(
        rename = "rateLimitedAccounts",
        skip_serializing_if = "Option::is_none"
    )]
    pub rate_limited_accounts: Option<Vec<models::BulkUploadResultRateLimitedAccountsInner>>,
}

impl BulkUploadResult {
    /// Result of a CSV bulk upload. The same shape is returned for `200` (all rows succeeded or all failed) and `207` (mixed). Per-row outcomes live in `results`; the row's success is `ok`, and failures carry machine-readable codes in `errors`.
    pub fn new() -> BulkUploadResult {
        BulkUploadResult {
            total: None,
            valid: None,
            invalid: None,
            results: None,
            warnings: None,
            rate_limited_accounts: None,
        }
    }
}
