///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
use crate::payload;
use crate::proto::common::*;
use crate::{client::Client, error::Error};

impl Client {
    /// List all symbols for the given account.
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    /// Mirrors `ProtoOASymbolsListReq`.
    pub async fn symbols_list(
        &self,
        ctid_trader_account_id: i64,
        include_archived: bool,
    ) -> Result<ProtoOaSymbolsListRes, Error> {
        let req = ProtoOaSymbolsListReq {
            payload_type: Some(payload::OA_SYMBOLS_LIST_REQ as i32),
            ctid_trader_account_id,
            include_archived_symbols: Some(include_archived),
        };
        self.command(
            payload::OA_SYMBOLS_LIST_REQ,
            req,
            payload::OA_SYMBOLS_LIST_RES,
        )
        .await
    }

    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    pub async fn subscribe_symbol(
        &self,
        symbol_id: Vec<i64>,
        ctid_trader_account_id: i64,
    ) -> Result<ProtoOaSubscribeSpotsRes, Error> {
        let req = ProtoOaSubscribeSpotsReq {
            symbol_id,
            subscribe_to_spot_timestamp: Some(true),
            payload_type: Some(crate::payload::OA_SUBSCRIBE_SPOTS_REQ as i32),
            ctid_trader_account_id,
        };

        self.command(
            crate::payload::OA_SUBSCRIBE_SPOTS_REQ,
            req,
            crate::payload::OA_SUBSCRIBE_SPOTS_RES,
        )
        .await
    }

    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    ///
    pub async fn symbol_by_id(
        &self,
        symbol_id: Vec<i64>,
        ctid_trader_account_id: i64,
    ) -> Result<ProtoOaSymbolByIdReq, Error> {
        let req = ProtoOaSymbolByIdReq {
            ctid_trader_account_id,
            symbol_id,
            payload_type: Some(crate::payload::OA_SYMBOL_BY_ID_REQ as i32),
        };

        self.command(
            crate::payload::OA_SYMBOL_BY_ID_REQ,
            req,
            crate::payload::OA_SYMBOL_BY_ID_RES,
        )
        .await
    }
}

#[cfg(test)]
mod tests {

    #[tokio::test]
    async fn test() {}
}
