enbbox 1.0.1

Notification infrastructure API — open-source alternative to Novu/Courier
Documentation
/*
 * enbbox API
 *
 * Notification infrastructure API — open-source alternative to Novu/Courier
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// MemberRecord : A member of the project with their assigned roles and invitation status.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MemberRecord {
    /// Email address (from user profile for active, from invite for pending).
    #[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub email: Option<Option<String>>,
    /// User's first name.
    #[serde(rename = "first_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub first_name: Option<Option<String>>,
    /// Member UUID.
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// When the invitation was sent (present only for pending invitations).
    #[serde(rename = "invite_date", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub invite_date: Option<Option<String>>,
    /// User's last name.
    #[serde(rename = "last_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_name: Option<Option<String>>,
    /// Profile picture URL.
    #[serde(rename = "profile_picture", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub profile_picture: Option<Option<String>>,
    /// Assigned roles.
    #[serde(rename = "roles")]
    pub roles: Vec<String>,
    /// Membership status: `invited`, `active`, or `new`.
    #[serde(rename = "status")]
    pub status: String,
    /// Associated user ID (null if invitation is still pending).
    #[serde(rename = "user_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub user_id: Option<Option<uuid::Uuid>>,
}

impl MemberRecord {
    /// A member of the project with their assigned roles and invitation status.
    pub fn new(id: uuid::Uuid, roles: Vec<String>, status: String) -> MemberRecord {
        MemberRecord {
            email: None,
            first_name: None,
            id,
            invite_date: None,
            last_name: None,
            profile_picture: None,
            roles,
            status,
            user_id: None,
        }
    }
}