using System.Diagnostics.CodeAnalysis;
namespace Solicitors.HtmlParsing.Models;
public interface IHtmlNode
{
///
/// Searches this node and its direct children for a matching tag name.
///
/// The tag name to match.
/// If found, the node that matches the tag name.
/// If true, only check this node, not its children.
/// True if this node, or any of its direct children, have a matching tag name; false otherwise.
bool TryGetByTagName(
string tagName,
[NotNullWhen(true)] out IHtmlNode? node,
bool noChildren = false);
///
/// Searches this node and its direct children for a matching class.
///
/// The class name to match.
/// If found, the node that matches the class name.
/// If true, only check this node, not its children.
/// True if this node, or any of its direct children, have a matching class name; false otherwise.
bool TryGetByClass(
string className,
[NotNullWhen(true)] out IHtmlNode? node,
bool noChildren = false);
///
/// Searches this node and its direct children for a matching tag name and matching class on the same node.
///
/// The tag name to match.
/// The class name to match.
/// If found, the node that matches the tag name and class name.
/// If true, only check this node, not its children.
/// True if this node, or any of its direct children, have a matching tag name and class name; false otherwise.
bool TryGetByTagNameAndClass(
string tagName,
string className,
[NotNullWhen(true)] out IHtmlNode? node,
bool noChildren = false);
///
/// Checks this node (and *not* its children) to see if it is text content.
///
/// If found, the text content.
/// True if the node is a text node, false otherwise.
bool TryGetText([NotNullWhen(true)] out string? text);
///
/// Checks this node to see if it has child elements.
///
/// If found, the child elements.
/// True if the node has child elements, false otherwise.
bool TryGetChildren([NotNullWhen(true)] out IEnumerable? children);
bool HasAttribute(string attributeName);
bool TryGetAttributeValue(
string attributeName,
[NotNullWhen(true)] out string? attributeValue);
}