signer-daemon 0.3.0

Signer daemon package.
Documentation
use poem_openapi::{Object, Union};
use serde::{Deserialize, Serialize};

use crate::model::viewobject::{ChatVO as CoreChatVO, PrivateChatVO as CorePrivateChatVO};

#[derive(Debug, Clone, Serialize, Deserialize, Union)]
pub enum OApiChatVO {
    Private(OApiPrivateChatVO),
}

impl From<CoreChatVO> for OApiChatVO {
    fn from(value: CoreChatVO) -> Self {
        match value {
            CoreChatVO::Private(p) => Self::Private(p.into()),
        }
    }
}

impl Into<CoreChatVO> for OApiChatVO {
    fn into(self) -> CoreChatVO {
        match self {
            OApiChatVO::Private(p) => CoreChatVO::Private(p.into()),
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Object, PartialEq)]
pub struct OApiPrivateChatVO {
    pub peers: Vec<String>,
}

impl From<CorePrivateChatVO> for OApiPrivateChatVO {
    fn from(value: CorePrivateChatVO) -> Self {
        Self {
            peers: value.peers,
        }
    }
}

impl Into<CorePrivateChatVO> for OApiPrivateChatVO {
    fn into(self) -> CorePrivateChatVO {
        CorePrivateChatVO {
            peers: self.peers,
        }
    }
}