/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.6
 * Contact: contact@orvanta.cloud
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UserSource {
    /// How the user was added to the workspace
    #[serde(rename = "source")]
    pub source: Source,
    /// The domain used for auto-invite (when source is 'domain')
    #[serde(rename = "domain", skip_serializing_if = "Option::is_none")]
    pub domain: Option<String>,
    /// The instance group name (when source is 'instance_group')
    #[serde(rename = "group", skip_serializing_if = "Option::is_none")]
    pub group: Option<String>,
}

impl UserSource {
    pub fn new(source: Source) -> UserSource {
        UserSource {
            source,
            domain: None,
            group: None,
        }
    }
}
/// How the user was added to the workspace
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Source {
    #[serde(rename = "domain")]
    Domain,
    #[serde(rename = "instance_group")]
    InstanceGroup,
    #[serde(rename = "manual")]
    Manual,
}

impl Default for Source {
    fn default() -> Source {
        Self::Domain
    }
}

