use serde::{Deserialize, Serialize};
use crate::common::myfs::*;
pub const CMD_CD: &'static str = "cd";
pub const CMD_SEND: &'static str = "send";
pub const CMD_REC: &'static str = "rec";
pub const CMD_SEND_ALL: &'static str = "send_all";
pub const CMD_EXIT: &'static str = "exit";
pub const CMD_USE: &'static str = "use";
pub const CMD_RESTART: &'static str = "restart";
pub const CMD_WAIT: &'static str = "wait";
pub const FAIL: &'static str = "fail";
pub const SUCCESS: &'static str = "success";
pub const REQ_DURATION: &'static u64 = &10;
pub const TOPIC_ALL: &'static str = "topic_order";
pub const TOPIC_RESTART: &'static str = "topic_restart";

lazy_static! {
    pub static ref NATS_URL:String =get_dot_env("NATS_URL");
    pub static ref NATS_ACCOUNT:String =get_dot_env("NATS_ACCOUNT");
    pub static ref NATS_PWD:String =get_dot_env("NATS_PWD");
    pub static ref SLAVE_ID:String=get_dot_env("SLAVE_ID");

}

#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct Order {
    pub slave: String,
    pub status: String,
    pub wait:bool,
    pub req: String,
    pub resp: String,
}

impl Order {
    pub fn new_from_host(input: &str, _slave: &str) -> Order {
        Order {
            slave: _slave.to_string(),
            status:SUCCESS.to_string(),
            wait:true,
            req: input.to_string(),
            resp: "".to_string(),
        }
    }

}


