use syn::{GenericArgument, PathArguments, Type};
/// Checks if a type is Option<T> and returns (is_option, inner_type).
/// If not an Option, returns the original type as inner_type.
pub fn extract_option_inner_type(ty: &Type) -> (bool, Type) {
if let Type::Path(type_path) = ty
&& let Some(last_segment) = type_path.path.segments.last()
&& last_segment.ident == "Option"
&& let PathArguments::AngleBracketed(args) = &last_segment.arguments
&& let Some(GenericArgument::Type(inner_type)) = args.args.first()
{
(true, inner_type.clone())
} else {
(false, ty.clone())
}
}