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

/// V2CheckInfo : Everything a client needs to know to use a check type via the API.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V2CheckInfo {
    #[serde(rename = "check_type")]
    pub check_type: String,
    #[serde(rename = "display_name")]
    pub display_name: String,
    #[serde(rename = "description", deserialize_with = "Option::deserialize")]
    pub description: Option<String>,
    #[serde(rename = "has_config")]
    pub has_config: bool,
    /// True for checks added automatically (e.g. as a dependency) - clients neither add nor configure these.
    #[serde(rename = "is_system_managed")]
    pub is_system_managed: bool,
    /// Other check types this check pulls in automatically when added.
    #[serde(rename = "requires_checks")]
    pub requires_checks: Vec<String>,
    #[serde(rename = "supported_countries_of_work")]
    pub supported_countries_of_work: Vec<String>,
    #[serde(rename = "supported_countries_of_residence")]
    pub supported_countries_of_residence: Vec<String>,
    #[serde(rename = "default_price", deserialize_with = "Option::deserialize")]
    pub default_price: Option<Box<models::V2Money>>,
    #[serde(rename = "config_fields")]
    pub config_fields: Vec<models::V2CheckField>,
    #[serde(rename = "input_fields")]
    pub input_fields: Vec<models::V2CheckField>,
    /// Screening-level candidate facts this check needs (name, email, sometimes date of birth, etc.).
    #[serde(rename = "candidate_fields")]
    pub candidate_fields: Vec<models::V2CheckField>,
}

impl V2CheckInfo {
    /// Everything a client needs to know to use a check type via the API.
    pub fn new(check_type: String, display_name: String, description: Option<String>, has_config: bool, is_system_managed: bool, requires_checks: Vec<String>, supported_countries_of_work: Vec<String>, supported_countries_of_residence: Vec<String>, default_price: Option<models::V2Money>, config_fields: Vec<models::V2CheckField>, input_fields: Vec<models::V2CheckField>, candidate_fields: Vec<models::V2CheckField>) -> V2CheckInfo {
        V2CheckInfo {
            check_type,
            display_name,
            description,
            has_config,
            is_system_managed,
            requires_checks,
            supported_countries_of_work,
            supported_countries_of_residence,
            default_price: if let Some(x) = default_price {Some(Box::new(x))} else {None},
            config_fields,
            input_fields,
            candidate_fields,
        }
    }
}

