/*
 * Pescheck API
 *
 * Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
 *
 * The version of the OpenAPI document: 2.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// V2ScreeningListItem : List shape for GET /screenings/. Same candidate as detail; the only thing we slim here is per-check info (status only), since config/input/output are heavy and rarely needed at list time.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V2ScreeningListItem {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    #[serde(rename = "profile", deserialize_with = "Option::deserialize")]
    pub profile: Option<Box<models::V2ScreeningDetailProfile>>,
    #[serde(rename = "candidate")]
    pub candidate: Box<models::V2Candidate>,
    #[serde(rename = "checks")]
    pub checks: Vec<models::V2ScreeningCheckListItem>,
    #[serde(rename = "candidate_wizard_url", deserialize_with = "Option::deserialize")]
    pub candidate_wizard_url: Option<String>,
    #[serde(rename = "dashboard_url")]
    pub dashboard_url: String,
    #[serde(rename = "created_at")]
    pub created_at: chrono::DateTime<chrono::FixedOffset>,
    #[serde(rename = "updated_at")]
    pub updated_at: chrono::DateTime<chrono::FixedOffset>,
}

impl V2ScreeningListItem {
    /// List shape for GET /screenings/. Same candidate as detail; the only thing we slim here is per-check info (status only), since config/input/output are heavy and rarely needed at list time.
    pub fn new(id: uuid::Uuid, profile: Option<models::V2ScreeningDetailProfile>, candidate: models::V2Candidate, checks: Vec<models::V2ScreeningCheckListItem>, candidate_wizard_url: Option<String>, dashboard_url: String, created_at: chrono::DateTime<chrono::FixedOffset>, updated_at: chrono::DateTime<chrono::FixedOffset>) -> V2ScreeningListItem {
        V2ScreeningListItem {
            id,
            status: None,
            profile: if let Some(x) = profile {Some(Box::new(x))} else {None},
            candidate: Box::new(candidate),
            checks,
            candidate_wizard_url,
            dashboard_url,
            created_at,
            updated_at,
        }
    }
}

