/*
 * 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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V2ScreeningDetail {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "status")]
    pub status: 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::V2ScreeningCheckEntry>,
    /// Public wizard URL for the candidate. Null when no check needs candidate input.
    #[serde(rename = "candidate_wizard_url", deserialize_with = "Option::deserialize")]
    pub candidate_wizard_url: Option<String>,
    /// Dashboard URL for this screening.
    #[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 V2ScreeningDetail {
    pub fn new(id: uuid::Uuid, status: String, profile: Option<models::V2ScreeningDetailProfile>, candidate: models::V2Candidate, checks: Vec<models::V2ScreeningCheckEntry>, candidate_wizard_url: Option<String>, dashboard_url: String, created_at: chrono::DateTime<chrono::FixedOffset>, updated_at: chrono::DateTime<chrono::FixedOffset>) -> V2ScreeningDetail {
        V2ScreeningDetail {
            id,
            status,
            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,
        }
    }
}

