use log::info;
use std::time::Duration;

use iced::task::{Never, Sipper, sipper};
pub struct StepDownloader {
    nothing: String,
}

#[derive(Debug, PartialEq, Eq, Clone)]
pub enum StepDownloaderMsg {
    Nothing,
    SearchKeyword(String),
}
#[derive(Debug, Clone)]
pub enum StepDownloaderEvent {
    Nothing,
}

impl StepDownloader {
    pub fn create_process() -> impl Sipper<Never, StepDownloaderEvent> {
        info!("Start create the process.");
        sipper(async |mut output| {
            loop {
                output.send(StepDownloaderEvent::Nothing).await;
                info!("In process print once.");

                loop {
                    info!("In process print tick A.");
                    tokio::time::sleep(Duration::from_millis(1000)).await;
                    // output.send(StepDownloaderEvent::Nothing).await;
                    info!("In process print tick A.");
                    tokio::time::sleep(Duration::from_millis(1000)).await;
                }
            }
        })
    }
}
