/*This file is automatically generated by pkg.deepin.io/dbus-generator. Don't edit it*/
package udisks2

import "pkg.deepin.io/lib/dbus"
import "pkg.deepin.io/lib/dbus/property"
import "reflect"
import "sync"
import "runtime"
import "fmt"
import "errors"

/*prevent compile error*/
var _ = fmt.Println
var _ = runtime.SetFinalizer
var _ = sync.NewCond
var _ = reflect.TypeOf
var _ = property.BaseObserver{}

type Encrypted struct {
	Path     dbus.ObjectPath
	DestName string
	core     *dbus.Object
}

func (obj *Encrypted) Unlock(passphrase string, options map[string]dbus.Variant) (cleartext_device dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.UDisks2.Encrypted.Unlock", 0, passphrase, options).Store(&cleartext_device)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Encrypted) Lock(options map[string]dbus.Variant) (_err error) {
	_err = obj.core.Call("org.freedesktop.UDisks2.Encrypted.Lock", 0, options).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Encrypted) ChangePassphrase(passphrase string, new_passphrase string, options map[string]dbus.Variant) (_err error) {
	_err = obj.core.Call("org.freedesktop.UDisks2.Encrypted.ChangePassphrase", 0, passphrase, new_passphrase, options).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func NewEncrypted(destName string, path dbus.ObjectPath) (*Encrypted, error) {
	if !path.IsValid() {
		return nil, errors.New("The path of '" + string(path) + "' is invalid.")
	}

	core := getBus().Object(destName, path)

	obj := &Encrypted{Path: path, DestName: destName, core: core}

	return obj, nil
}
