mod engine;
#[cfg(test)]
mod engine_test;
pub use engine::{PerceptionEngine, PerceptionConfig};
use crate::dom::views::{PageIntent, SemanticRole};
impl SemanticRole {
pub fn label(&self) -> &'static str {
match self {
SemanticRole::SearchForm => "🔍 search",
SemanticRole::LoginForm => "🔑 login",
SemanticRole::RegistrationForm => "📝 register",
SemanticRole::Navigation => "🧭 nav",
SemanticRole::Pagination => "📄 pagination",
SemanticRole::ProductCard => "🛒 product",
SemanticRole::Article => "📰 article",
SemanticRole::FilterPanel => "🔧 filter",
SemanticRole::PrimaryAction => "⭐ primary",
SemanticRole::SecondaryAction => " secondary",
SemanticRole::SubmitButton => "✓ submit",
SemanticRole::TextInput => "⌨ text",
SemanticRole::Dropdown => "▼ dropdown",
SemanticRole::ToggleGroup => "☐ toggle",
SemanticRole::DatePicker => "📅 date",
SemanticRole::FileUpload => "📎 file",
SemanticRole::Captcha => "🤖 captcha",
SemanticRole::CookieConsent => "🍪 cookie",
SemanticRole::Advertisement => "📢 ad",
SemanticRole::Footer => "📎 footer",
SemanticRole::Header => "📌 header",
SemanticRole::Sidebar => "📋 sidebar",
SemanticRole::MainContent => "📄 main",
SemanticRole::Unknown => "",
}
}
}
impl PageIntent {
pub fn description(&self) -> &'static str {
match self {
PageIntent::Login => "login/authentication page",
PageIntent::SearchResults => "search results page",
PageIntent::ProductListing => "product listing/catalog",
PageIntent::ProductDetail => "product detail page",
PageIntent::Article => "article or blog post",
PageIntent::FormPage => "form submission page",
PageIntent::Checkout => "checkout/payment flow",
PageIntent::ErrorPage => "error page",
PageIntent::Captcha => "CAPTCHA/verification challenge",
PageIntent::CookieConsent => "cookie consent/privacy notice",
PageIntent::Landing => "landing page",
PageIntent::Unknown => "unknown page type",
}
}
}