use std::borrow::Cow;
use std::sync::LazyLock;

use bevy::color::Color;
use bevy::math::Vec2;

pub const TITLE: &str = "Kodumaro Nonogram";

pub const RESOLUTION: Vec2 = Vec2::new(1280.0, 720.0) ;
pub const GAME_AREA: Vec2 = Vec2::new(RESOLUTION.x * 3.0/4.0, RESOLUTION.y * 2.0/3.0);

pub const Y_OFFSET: f32 = RESOLUTION.y - GAME_AREA.y;

pub const BACKGROUND_COLOR: Color = Color::srgb_u8(0xf5, 0xd3, 0xb3);
pub const BLUR_COLOR: Color = Color::srgba_u8(0x00, 0x00, 0x00, 0xa0);
pub const TITLE_COLOR: Color = Color::srgb_u8(0x00, 0x8b, 0x8b);
pub const VERSION_COLOR: Color = Color::srgba_u8(0x00, 0x8b, 0x8b, 0x80);

pub const EVEN_COLOR: Color = BACKGROUND_COLOR;
pub const ODD_COLOR: Color = Color::srgb_u8(0x8b, 0x8b, 0x8b);
pub const HOVER_COLOR: Color = Color::srgb_u8(0xff, 0x00, 0x00);

pub static APP_VERSION: LazyLock<Cow<'static, str>> = LazyLock::new(|| {
    let version = include_str!("../Cargo.toml").lines()
        .find(|line| line.starts_with("version = "))
        .unwrap();
    let version = version.split('"').nth(1).unwrap();
    Cow::Borrowed(version)
});
