use serde::Deserialize;
use super::HostContext;
use crate::db::adapt_sql;
use crate::plugin::StrongRef;
#[derive(Debug, thiserror::Error)]
pub enum LookupError {
#[error("Database error: {0}")]
Database(#[from] sqlx::Error),
#[error("Invalid external ID field path")]
InvalidFieldPath,
}
#[derive(Debug, Deserialize)]
pub struct LookupRequest {
pub collection: String,
pub external_id_field: String,
pub external_id_value: String,
}
/// Look up a record by external ID
///
/// # Arguments
/// * `collection` - Lexicon collection ID (e.g., "games.gamesgamesgamesgames.game")
/// * `external_id_field` - JSON path to external ID field (e.g., "externalIds.steam")
/// * `external_id_value` - Value to match
pub async fn lookup_record(
ctx: &HostContext,
collection: &str,
external_id_field: &str,
external_id_value: &str,
) -> Result