/*
 * Streams API
 *
 * Manage Tapis Streams API.
 *
 * The version of the OpenAPI document: 1
 * Contact: cicsupport@tacc.utexas.edu
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NewRole {
    /// User id whom the role is to be granted
    #[serde(rename = "user", skip_serializing_if = "Option::is_none")]
    pub user: Option<String>,
    /// project or channel id/id
    #[serde(rename = "resource_id", skip_serializing_if = "Option::is_none")]
    pub resource_id: Option<String>,
    /// Resource type should be either project or channel
    #[serde(rename = "resource_type", skip_serializing_if = "Option::is_none")]
    pub resource_type: Option<ResourceType>,
    /// role name
    #[serde(rename = "role_name", skip_serializing_if = "Option::is_none")]
    pub role_name: Option<RoleName>,
}

impl NewRole {
    pub fn new() -> NewRole {
        NewRole {
            user: None,
            resource_id: None,
            resource_type: None,
            role_name: None,
        }
    }
}
/// Resource type should be either project or channel
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum ResourceType {
    #[serde(rename = "project")]
    #[default]
    Project,
    #[serde(rename = "channel")]
    Channel,
    #[serde(rename = "template")]
    Template,
}

/// role name
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum RoleName {
    #[serde(rename = "admin")]
    #[default]
    Admin,
    #[serde(rename = "manager")]
    Manager,
    #[serde(rename = "user")]
    User,
}
