use serde::{Deserialize, Serialize};

/// Tipo de documento do hóspede
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum GuestDocumentType {
    /// CPF
    Cpf,
    /// RG
    Rg,
    /// Passaporte
    Passport,
    /// Documento de identidade
    Id,
    /// Outro tipo de documento
    Other,
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_guest_document_type_serialization() {
        let cpf = GuestDocumentType::Cpf;
        let json = serde_json::to_string(&cpf).unwrap();
        assert_eq!(json, r#""cpf""#);

        let passport = GuestDocumentType::Passport;
        let json = serde_json::to_string(&passport).unwrap();
        assert_eq!(json, r#""passport""#);
    }

    #[test]
    fn test_guest_document_type_deserialization() {
        let json = r#""cpf""#;
        let doc_type: GuestDocumentType = serde_json::from_str(json).unwrap();
        assert_eq!(doc_type, GuestDocumentType::Cpf);

        let json = r#""passport""#;
        let doc_type: GuestDocumentType = serde_json::from_str(json).unwrap();
        assert_eq!(doc_type, GuestDocumentType::Passport);
    }
}

