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

use zbus::{
    proxy,
};

use crate::error;

#[proxy(
    interface = "org.freedesktop.UDisks2.Block",
    default_service = "org.freedesktop.UDisks2",
    default_path = "/org/freedesktop/UDisks2/Block"
)]
trait Block {
    /// AddConfigurationItem method
    fn add_configuration_item(
        &self,
        item: &(
            &str,
            std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
        ),
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<()>;

    /// Format method
    fn format(
        &self,
        type_: &str,
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<()>;

    /// GetSecretConfiguration method
    fn get_secret_configuration(
        &self,
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<
        Vec<(
            String,
            std::collections::HashMap<String, zbus::zvariant::OwnedValue>,
        )>,
    >;

    /// OpenDevice method
    fn open_device(
        &self,
        mode: &str,
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<zbus::zvariant::OwnedFd>;

    /// OpenForBackup method
    fn open_for_backup(
        &self,
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<zbus::zvariant::OwnedFd>;

    /// OpenForBenchmark method
    fn open_for_benchmark(
        &self,
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<zbus::zvariant::OwnedFd>;

    /// OpenForRestore method
    fn open_for_restore(
        &self,
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<zbus::zvariant::OwnedFd>;

    /// RemoveConfigurationItem method
    fn remove_configuration_item(
        &self,
        item: &(
            &str,
            std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
        ),
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<()>;

    /// Rescan method
    fn rescan(
        &self,
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<()>;

    /// UpdateConfigurationItem method
    fn update_configuration_item(
        &self,
        old_item: &(
            &str,
            std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
        ),
        new_item: &(
            &str,
            std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
        ),
        options: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> error::Result<()>;

    /// Configuration property
    #[zbus(property)]
    fn configuration(
        &self,
    ) -> error::Result<
        Vec<(
            String,
            std::collections::HashMap<String, zbus::zvariant::OwnedValue>,
        )>,
    >;

    /// CryptoBackingDevice property
    #[zbus(property)]
    fn crypto_backing_device(&self) -> error::Result<zbus::zvariant::OwnedObjectPath>;

    /// Device property
    #[zbus(property)]
    fn device(&self) -> error::Result<Vec<u8>>;

    /// DeviceNumber property
    #[zbus(property)]
    fn device_number(&self) -> error::Result<u64>;

    /// Drive property
    #[zbus(property)]
    fn drive(&self) -> error::Result<zbus::zvariant::OwnedObjectPath>;

    /// HintAuto property
    #[zbus(property)]
    fn hint_auto(&self) -> error::Result<bool>;

    /// HintIconName property
    #[zbus(property)]
    fn hint_icon_name(&self) -> error::Result<String>;

    /// HintIgnore property
    #[zbus(property)]
    fn hint_ignore(&self) -> error::Result<bool>;

    /// HintName property
    #[zbus(property)]
    fn hint_name(&self) -> error::Result<String>;

    /// HintPartitionable property
    #[zbus(property)]
    fn hint_partitionable(&self) -> error::Result<bool>;

    /// HintSymbolicIconName property
    #[zbus(property)]
    fn hint_symbolic_icon_name(&self) -> error::Result<String>;

    /// HintSystem property
    #[zbus(property)]
    fn hint_system(&self) -> error::Result<bool>;

    /// Id property
    #[zbus(property)]
    fn id(&self) -> error::Result<String>;

    /// IdLabel property
    #[zbus(property)]
    fn id_label(&self) -> error::Result<String>;

    /// IdType property
    #[zbus(property)]
    fn id_type(&self) -> error::Result<String>;

    /// IdUUID property
    #[zbus(property, name = "IdUUID")]
    fn id_uuid(&self) -> error::Result<String>;

    /// IdUsage property
    #[zbus(property)]
    fn id_usage(&self) -> error::Result<String>;

    /// IdVersion property
    #[zbus(property)]
    fn id_version(&self) -> error::Result<String>;

    /// MDRaid property
    #[zbus(property, name = "MDRaid")]
    fn mdraid(&self) -> error::Result<zbus::zvariant::OwnedObjectPath>;

    /// MDRaidMember property
    #[zbus(property, name = "MDRaidMember")]
    fn mdraid_member(&self) -> error::Result<zbus::zvariant::OwnedObjectPath>;

    //TODO: a lot of functions return Strings as c type strings (i.e. vec of u8 with \0 bytes)
    //they should be updated to return rust strings
    /// PreferredDevice property
    #[zbus(property)]
    fn preferred_device(&self) -> error::Result<Vec<u8>>;

    /// ReadOnly property
    #[zbus(property)]
    fn read_only(&self) -> error::Result<bool>;

    /// Size property
    #[zbus(property)]
    fn size(&self) -> error::Result<u64>;

    /// Symlinks property
    #[zbus(property)]
    fn symlinks(&self) -> error::Result<Vec<Vec<u8>>>;

    /// UserspaceMountOptions property
    #[zbus(property)]
    fn userspace_mount_options(&self) -> error::Result<Vec<String>>;
}
