#![allow(dead_code)]

pub mod character_en;
pub mod character_ja;
pub mod dialog_en;
pub mod dialog_ja;
pub mod item_en;
pub mod item_ja;
pub mod location_en;
pub mod location_ja;
pub mod snippet_en;
pub mod snippet_ja;

use crate::character::Character;
use crate::condition::Condition;
use crate::entity::Entity;
use crate::item::Item;
use crate::location::Location;
use crate::save_point::SavePoint;
use crate::snippet::Snippet;
use crate::sound::Sound;
use crate::style::Style;

#[derive(Clone, Debug)]
pub enum Token<'s, L> {
    String(&'s str),
    MoonHieroglyph,
    GooseHieroglyph,
    BeetleHieroglyph,
    LargeGlyph(char),
    Character(Character),
    Item(Item),
    Location(Location),
    Snippet(Snippet),
    Dakuten,
    Handakuten,
    IdeographicSpace,
    WideSpace,
    NewLine,
    More,
    Speed(u8),
    // UnknownCommand00SetFlag1,
    // UnknownCommand01,
    Clear,
    Style(Style),
    Prompt(Condition),
    ScrollOut(u8, u8),
    PromptStyle([Style; 2]),
    JumpIfNo(L),
    ToggleCanSpeedUp,
    Wait(u8),
    SetOutline(bool),
    Save(SavePoint),
    PushItem,
    UseItem,
    SetPepelogooLevel(u8),
    Price(u16),
    // CheckCanBuy(u16),
    Sell,
    // Buy,
    IncantSpell(&'s str),
    StartQuizz(u32),
    CorrectAnswer(u8),
    PauseSound,
    ResumeSound,
    UnknownCommand18(u16, u16),
    AnimateAsha(u8, u8, u8),
    Animate(Entity, u8, u8, u8, u8),
    Merchant([Option<Item>; 3], i16, i16),
    RemoveItem(Item),
    GainHearts(u8),
    CheckCanGainHearts(u16),
    // SomethingAndPlaySound(Sound),
    // UnknownE2,
    // UnknownE3,
    SeekIfRand(u16, L),
    // UnknownE5(u8, u16, u16, u16, u16),
    // UnknownE6(u16, u16),
    SeekIfOwned(Item, L),
    SeekIfUnowned(Item, L),
    // UnknownE9(u16),
    // UnknownEA(u16, u16, u16, u16, u16),
    // UnknownEB(u16),
    // UnknownEC(u8, u16, u16, u8, u8, u8, u8),
    // UnknownED(u16, u16),
    // UnknownEE(u16),
    // UnknownEF(u8),
    // UnusedSeekIfOwned(Item, L),
    // UnknownF1(u16, u8, u16),
    // UnknownF2(u8, u8, u8, u8, u8, i16),
    // UnknownF3(u8, u8, u8, u8, u8),
    // UnknownF4(u8, u16),
    // UnknownF5(u16),
    // UnknownF6(u16, u16, u16, u16),
    // UnknownF7EntityPositionRelated(u8, u8, u8, u8, u8, u8, u8, u8),
    SetTrue(Condition),
    // Nop,
    SetFalse(Condition),
    PlaySound(Sound),
    SeekIfFalse(Condition, L),
    SeekIfTrue(Condition, L),
    Seek(L),
    End,
    Label(L),
    Error(&'s str),
}

macro_rules! token {
    ($e:literal) => {
        crate::script::Token::String($e)
    };
    ($e:expr) => {
        $e
    };
}

pub(crate) use token;

macro_rules! script {
    ( $($e:expr) +) => {
        &[ $(crate::script::token!($e),)+ ]
    }
}

pub(crate) use script;
