use crate::prelude::*;
use nu_protocol::UntaggedValue;

mod dynamic;
pub(crate) mod external;
pub(crate) mod internal;
pub(crate) mod pipeline;

#[allow(unused_imports)]
pub(crate) use dynamic::Command as DynamicCommand;

pub(crate) struct ClassifiedInputStream {
    pub(crate) objects: InputStream,
    pub(crate) stdin: Option<std::fs::File>,
}

impl ClassifiedInputStream {
    pub(crate) fn new() -> ClassifiedInputStream {
        ClassifiedInputStream {
            objects: vec![UntaggedValue::nothing().into_value(Tag::unknown())].into(),
            stdin: None,
        }
    }

    pub(crate) fn from_input_stream(stream: impl Into<InputStream>) -> ClassifiedInputStream {
        ClassifiedInputStream {
            objects: stream.into(),
            stdin: None,
        }
    }

    pub(crate) fn from_stdout(stdout: std::fs::File) -> ClassifiedInputStream {
        ClassifiedInputStream {
            objects: VecDeque::new().into(),
            stdin: Some(stdout),
        }
    }
}
