//! # `DBus` interface proxy for: `org.a11y.atspi.Component`
//!
//! This code was generated by `zbus-xmlgen` `2.0.1` from `DBus` introspection data.
//! Source: `Component.xml`.
//!
//! You may prefer to adapt it, instead of using it verbatim.
//!
//! More information can be found in the
//! [Writing a client proxy](https://dbus.pages.freedesktop.org/zbus/client.html)
//! section of the zbus documentation.
//!

use serde::{Deserialize, Serialize};
use zbus::{dbus_proxy, zvariant::Type};

/// Indicates relative stacking order of a [`ComponentProxy`] with respect to the
/// onscreen visual representation of the UI.
///
/// The layer index, in combination with the component's extents,
/// can be used to compute the visibility of all or part of a component.
/// This is important in programmatic determination of region-of-interest for magnification,
/// and in flat screen review models of the screen, as well as for other uses.
/// Objects residing in two of the `Layer` categories support further z-ordering information,
/// with respect to their peers in the same layer:
/// namely, [`Layer::Window`] and [`Layer::Mdi`].
/// Relative stacking order for other objects within the same layer is not available;
/// the recommended heuristic is first child paints first. In other words,
/// assume that the first siblings in the child list are subject to being
/// overpainted by later siblings if their bounds intersect.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
pub enum Layer {
    /// Indicates an error condition or uninitialized value.
    Invalid,
    /// Reserved for the desktop background; this is the bottom-most layer,
    /// over which everything else is painted.
    Background,
    /// The 'background' layer for most content renderers and
    /// UI [`ComponentProxy`] containers.
    Canvas,
    /// The layer in which the majority of ordinary 'foreground' widgets reside.
    Widget,
    /// A special layer between [`Layer::Canvas`] and [`Layer::Widget`], in which the
    /// 'pseudo windows' (e.g. the Multiple-Document Interface frames) reside.
    ///
    /// See [`ComponentProxy::get_mdizorder`].
    Mdi,
    /// A layer for popup window content, above [`Layer::Widget`].
    Popup,
    /// The topmost layer.
    Overlay,
    /// The layer in which a toplevel window background usually resides.
    Window,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
pub enum ScrollType {
    TopLeft,
    BottomRight,
    TopEdge,
    BottomEdge,
    LeftEdge,
    RightEdge,
    Anywhere,
}

use crate::CoordType;

#[dbus_proxy(interface = "org.a11y.atspi.Component", assume_defaults = true)]
trait Component {
    /// Contains method
    fn contains(&self, x: i32, y: i32, coord_type: CoordType) -> zbus::Result<bool>;

    /// GetAccessibleAtPoint method
    fn get_accessible_at_point(
        &self,
        x: i32,
        y: i32,
        coord_type: CoordType,
    ) -> zbus::Result<(String, zbus::zvariant::OwnedObjectPath)>;

    /// GetAlpha method
    fn get_alpha(&self) -> zbus::Result<f64>;

    /// GetExtents method
    fn get_extents(&self, coord_type: CoordType) -> zbus::Result<(i32, i32, i32, i32)>;

    /// GetLayer method
    fn get_layer(&self) -> zbus::Result<Layer>;

    /// GetMDIZOrder method
    fn get_mdizorder(&self) -> zbus::Result<i16>;

    /// GetPosition method
    fn get_position(&self, coord_type: CoordType) -> zbus::Result<(i32, i32)>;

    /// GetSize method
    fn get_size(&self) -> zbus::Result<(i32, i32)>;

    /// GrabFocus method
    fn grab_focus(&self) -> zbus::Result<bool>;

    /// ScrollTo method
    fn scroll_to(&self, type_: ScrollType) -> zbus::Result<bool>;

    /// ScrollToPoint method
    fn scroll_to_point(&self, coord_type: CoordType, x: i32, y: i32) -> zbus::Result<bool>;

    /// SetExtents method
    fn set_extents(
        &self,
        x: i32,
        y: i32,
        width: i32,
        height: i32,
        coord_type: CoordType,
    ) -> zbus::Result<bool>;

    /// SetPosition method
    fn set_position(&self, x: i32, y: i32, coord_type: CoordType) -> zbus::Result<bool>;

    /// SetSize method
    fn set_size(&self, width: i32, height: i32) -> zbus::Result<bool>;
}
use crate::{AtspiProxy, Interface};
impl<'a> AtspiProxy for ComponentProxy<'a>{
	const INTERFACE: Interface = Interface::Component;
}