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

/// V2CheckField : One config or input field a check accepts via the API.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V2CheckField {
    #[serde(rename = "name")]
    pub name: String,
    /// \"string\" | \"integer\" | \"number\" | \"boolean\" | \"array\" | \"object\"
    #[serde(rename = "type")]
    pub r#type: String,
    /// Whether the request body must include this field.
    #[serde(rename = "required")]
    pub required: bool,
    /// Allowed values, or null if the field isn't constrained to a set.
    #[serde(rename = "choices", deserialize_with = "Option::deserialize")]
    pub choices: Option<Vec<String>>,
    #[serde(rename = "help_text", deserialize_with = "Option::deserialize")]
    pub help_text: Option<String>,
}

impl V2CheckField {
    /// One config or input field a check accepts via the API.
    pub fn new(name: String, r#type: String, required: bool, choices: Option<Vec<String>>, help_text: Option<String>) -> V2CheckField {
        V2CheckField {
            name,
            r#type,
            required,
            choices,
            help_text,
        }
    }
}

