use corevm_tooling::CoreVmCodeInfo;
use jam_program_blob_common::CrateInfo;
use jam_tooling::CodeInfo;
use jam_types::AnyHash;

pub fn print_service_info(outer: CodeInfo<&CrateInfo>, inner: Option<&CoreVmCodeInfo>) {
	match outer {
		CodeInfo::Known(outer) => {
			println!("Submitting to service identifying as {outer}");
			match inner {
				Some(CoreVmCodeInfo::Known(inner)) => println!("Current guest is {inner}"),
				Some(CoreVmCodeInfo::NotProvided(block_ref)) =>
					println!("File {block_ref} is not provided"),
				Some(CoreVmCodeInfo::Undefined(block_ref)) =>
					println!("Guest code metadata not found in {block_ref}"),
				None => {},
			}
		},
		CodeInfo::Undefined(hash) => println!("Service code {} not found", AnyHash(hash)),
		CodeInfo::CodeNotProvided(hash) =>
			println!("Service code {} is not provided", AnyHash(hash)),
	}
}
