use serde::{Deserialize, Serialize};

use crate::model::ProtoMessage;

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProtoMethod {
    pub name: String,
    pub input: ProtoMessage,
    pub output: ProtoMessage,
    pub client_streaming: bool,
    pub server_streaming: bool,
}

impl ProtoMethod {
    pub fn is_unary(&self) -> bool {
        !self.client_streaming && !self.server_streaming
    }
}
