use std::fs;

use proc_macro2::TokenStream;
use quote::quote;

use crate::array_to_tokenstream;

/// Generates the `TokenStream` for the `EntityPose` enum.
pub fn build() -> TokenStream {
    let poses: Vec<String> =
        serde_json::from_str(&fs::read_to_string("../../assets/entity_pose.json").unwrap())
            .expect("Failed to parse entity_pose.json");
    let variants = array_to_tokenstream(&poses);

    quote! {
        #[derive(PartialEq, Clone, Copy)]
        pub enum EntityPose {
            #variants
        }
    }
}
