use tinygfx::color::BlackWhite;
use tinygfx::Renderer;

pub mod clock;
pub mod tiles;

use clock::ClockView;
use tiles::TileView;

pub struct Ui {
    view: View,
}

impl Ui {
    pub fn view(view: View) -> Ui {
        Ui { view }
    }

    // TODO: Black/white/red frames or greyscale frames?
    pub fn draw(&self, renderer: &mut Renderer<BlackWhite>) {
        self.view.draw(renderer);
    }
}

pub enum View {
    Tiles(TileView),
    Clock(ClockView),
}

impl View {
    fn draw(&self, renderer: &mut Renderer<BlackWhite>) {
        match self {
            View::Tiles(view) => view.draw(renderer),
            View::Clock(view) => view.draw(renderer),
        }
    }
}
