# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.


import json
from typing import Optional, Union



from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
    raise RuntimeError("Python 2.7 or later required")

# Import the low-level C/C++ module
if __package__ or "." in __name__:
    from . import _verovio
else:
    import _verovio

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "thisown":
            self.this.own(value)
        elif name == "this":
            set(self, name, value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


class toolkit(object):
    r"""Proxy of C++ vrv::Toolkit class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, initFont=True):
        r"""__init__(toolkit self, bool initFont=True) -> toolkit"""
        _verovio.toolkit_swiginit(self, _verovio.new_toolkit(initFont))
    __swig_destroy__ = _verovio.delete_toolkit

    def getID(self):
        r"""getID(toolkit self) -> std::string"""
        return _verovio.toolkit_getID(self)

    def getResourcePath(self):
        r"""getResourcePath(toolkit self) -> std::string"""
        return _verovio.toolkit_getResourcePath(self)

    def setResourcePath(self, path):
        r"""setResourcePath(toolkit self, std::string const & path) -> bool"""
        return _verovio.toolkit_setResourcePath(self, path)

    def getLog(self):
        r"""getLog(toolkit self) -> std::string"""
        return _verovio.toolkit_getLog(self)

    def getVersion(self):
        r"""getVersion(toolkit self) -> std::string"""
        return _verovio.toolkit_getVersion(self)

    def resetXmlIdSeed(self, seed):
        r"""resetXmlIdSeed(toolkit self, int seed)"""
        return _verovio.toolkit_resetXmlIdSeed(self, seed)

    def loadFile(self, filename):
        r"""loadFile(toolkit self, std::string const & filename) -> bool"""
        return _verovio.toolkit_loadFile(self, filename)

    def loadData(self, data):
        r"""loadData(toolkit self, std::string const & data) -> bool"""
        return _verovio.toolkit_loadData(self, data)

    def loadZipDataBase64(self, data):
        r"""loadZipDataBase64(toolkit self, std::string const & data) -> bool"""
        return _verovio.toolkit_loadZipDataBase64(self, data)

    def loadZipDataBuffer(self, data, length):
        r"""loadZipDataBuffer(toolkit self, unsigned char const * data, int length) -> bool"""
        return _verovio.toolkit_loadZipDataBuffer(self, data, length)

    def validatePAEFile(self, filename):
        r"""validatePAEFile(toolkit self, std::string const & filename) -> std::string"""
        return _verovio.toolkit_validatePAEFile(self, filename)

    def validatePAE(toolkit, data: Union[str, dict]) -> dict:
        """Validate the Plaine and Easie code passed in the string data."""
        if isinstance(data, dict):
            data = json.dumps(data);
        return json.loads(_verovio.toolkit_validatePAE(toolkit, data))



    def getPageCount(self):
        r"""getPageCount(toolkit self) -> int"""
        return _verovio.toolkit_getPageCount(self)

    def getOptions(toolkit) -> dict:
        """Return a dictionary of all the options with their current value."""
        return json.loads(_verovio.toolkit_getOptions(toolkit))



    def getDefaultOptions(toolkit) -> dict:
        """Return a dictionary of all the options with their default value."""
        return json.loads(_verovio.toolkit_getDefaultOptions(toolkit))



    def getAvailableOptions(toolkit) -> dict:
        """Return a dictionary of all the options with their default value."""
        return json.loads(_verovio.toolkit_getAvailableOptions(toolkit))



    def setOptions(toolkit, json_options: dict) -> bool:
        """Set option values."""
        return _verovio.toolkit_setOptions(toolkit, json.dumps(json_options))



    def resetOptions(self):
        r"""resetOptions(toolkit self)"""
        return _verovio.toolkit_resetOptions(self)

    def printOptionUsage(self, category, output):
        r"""printOptionUsage(toolkit self, std::string const & category, std::ostream & output)"""
        return _verovio.toolkit_printOptionUsage(self, category, output)

    def getOptionUsageString(self):
        r"""getOptionUsageString(toolkit self) -> std::string"""
        return _verovio.toolkit_getOptionUsageString(self)

    def setScale(self, scale):
        r"""setScale(toolkit self, int scale) -> bool"""
        return _verovio.toolkit_setScale(self, scale)

    def getScale(self):
        r"""getScale(toolkit self) -> int"""
        return _verovio.toolkit_getScale(self)

    def setOutputTo(self, outputTo):
        r"""setOutputTo(toolkit self, std::string const & outputTo) -> bool"""
        return _verovio.toolkit_setOutputTo(self, outputTo)

    def select(toolkit, selection: dict) -> bool:
        """Set the value for a selection."""
        return _verovio.toolkit_select(toolkit, json.dumps(selection))



    def edit(toolkit, editor_action: dict) -> bool:
        """Edit the MEI data."""
        return _verovio.toolkit_edit(toolkit, json.dumps(editor_action))



    def editInfo(toolkit) -> dict:
        """Return the editor status."""
        return json.loads(_verovio.toolkit_editInfo(toolkit))



    def renderData(toolkit, data, options: dict) -> str:
        """Render the first page of the data to SVG."""
        return _verovio.toolkit_renderData(toolkit, data, json.dumps(options))



    def renderToSVG(self, pageNo=1, xmlDeclaration=False):
        r"""renderToSVG(toolkit self, int pageNo=1, bool xmlDeclaration=False) -> std::string"""
        return _verovio.toolkit_renderToSVG(self, pageNo, xmlDeclaration)

    def renderToSVGFile(self, filename, pageNo=1):
        r"""renderToSVGFile(toolkit self, std::string const & filename, int pageNo=1) -> bool"""
        return _verovio.toolkit_renderToSVGFile(self, filename, pageNo)

    def renderToMIDI(self):
        r"""renderToMIDI(toolkit self) -> std::string"""
        return _verovio.toolkit_renderToMIDI(self)

    def renderToMIDIFile(self, filename):
        r"""renderToMIDIFile(toolkit self, std::string const & filename) -> bool"""
        return _verovio.toolkit_renderToMIDIFile(self, filename)

    def renderToPAE(self):
        r"""renderToPAE(toolkit self) -> std::string"""
        return _verovio.toolkit_renderToPAE(self)

    def renderToPAEFile(self, filename):
        r"""renderToPAEFile(toolkit self, std::string const & filename) -> bool"""
        return _verovio.toolkit_renderToPAEFile(self, filename)

    def renderToTimemap(toolkit, options: Optional[dict] = None) -> list:
        """Render a document to a timemap."""
        if options is None:
            options = {}
        return json.loads(_verovio.toolkit_renderToTimemap(toolkit, json.dumps(options)))



    def renderToExpansionMap(toolkit) -> list:
        """Render a document's expansion map, if existing."""
        return json.loads(_verovio.toolkit_renderToExpansionMap(toolkit))



    def renderToTimemapFile(toolkit, filename: str, options: Optional[dict] = None) -> bool:
        """Render a document to timemap and save it to the file."""
        if options is None:
            options = {}
        return _verovio.toolkit_renderToTimemapFile(toolkit, filename, json.dumps(options))



    def renderToExpansionMapFile(toolkit, filename: str) -> bool:
        """Render a document's expansion map and save it to a file."""
        return _verovio.toolkit_renderToExpansionMapFile(toolkit, filename)



    def convertMEIToHumdrum(self, meiData):
        r"""convertMEIToHumdrum(toolkit self, std::string const & meiData) -> std::string"""
        return _verovio.toolkit_convertMEIToHumdrum(self, meiData)

    def convertHumdrumToHumdrum(self, humdrumData):
        r"""convertHumdrumToHumdrum(toolkit self, std::string const & humdrumData) -> std::string"""
        return _verovio.toolkit_convertHumdrumToHumdrum(self, humdrumData)

    def convertHumdrumToMIDI(self, humdrumData):
        r"""convertHumdrumToMIDI(toolkit self, std::string const & humdrumData) -> std::string"""
        return _verovio.toolkit_convertHumdrumToMIDI(self, humdrumData)

    def getHumdrumFile(self, filename):
        r"""getHumdrumFile(toolkit self, std::string const & filename) -> bool"""
        return _verovio.toolkit_getHumdrumFile(self, filename)

    def getMEI(toolkit, options: Optional[dict] = None) -> str:
        """Get the MEI as a string."""
        if options is None:
            options = {}
        return _verovio.toolkit_getMEI(toolkit, json.dumps(options))



    def saveFile(toolkit, filename: str, options: Optional[dict] = None) -> bool:
        """Get the MEI and save it to the file."""
        if options is None:
            options = {}
        return _verovio.toolkit_saveFile(toolkit, filename, json.dumps(options))



    def getDescriptiveFeatures(toolkit, options: Optional[dict] = None) -> dict:
        """Return descriptive features as dictionary."""
        if options is None:
            options = {}
        return json.loads(_verovio.toolkit_getDescriptiveFeatures(toolkit, json.dumps(options)))



    def getElementsAtTime(toolkit, millisec: int) -> dict:
        """Return array of IDs of elements being currently played."""
        return json.loads(_verovio.toolkit_getElementsAtTime(toolkit, millisec))



    def getPageWithElement(self, xmlId):
        r"""getPageWithElement(toolkit self, std::string const & xmlId) -> int"""
        return _verovio.toolkit_getPageWithElement(self, xmlId)

    def getElementAttr(toolkit, xml_id: str) -> dict:
        """Return element attributes as dictionary."""
        return json.loads(_verovio.toolkit_getElementAttr(toolkit, xml_id))



    def getNotatedIdForElement(self, xmlId):
        r"""getNotatedIdForElement(toolkit self, std::string const & xmlId) -> std::string"""
        return _verovio.toolkit_getNotatedIdForElement(self, xmlId)

    def getExpansionIdsForElement(toolkit, xml_id: str) -> dict:
        """Return a vector of ID strings of all elements (the notated and the expanded) for a given element."""
        return json.loads(_verovio.toolkit_getExpansionIdsForElement(toolkit, xml_id))



    def getTimeForElement(self, xmlId):
        r"""getTimeForElement(toolkit self, std::string const & xmlId) -> int"""
        return _verovio.toolkit_getTimeForElement(self, xmlId)

    def getMIDIValuesForElement(toolkit, xml_id: str) -> dict:
        """Return MIDI values of the element with the ID (xml:id)."""
        return json.loads(_verovio.toolkit_getMIDIValuesForElement(toolkit, xml_id))



    def getTimesForElement(toolkit, xml_id: str) -> dict:
        """Return a dictionary with the following key values for a given note."""
        return json.loads(_verovio.toolkit_getTimesForElement(toolkit, xml_id))



    def redoLayout(toolkit, options: Optional[dict] = None) -> None:
        """Redo the layout of the loaded data."""
        if options is None:
            options = {}
        return _verovio.toolkit_redoLayout(toolkit, json.dumps(options))



    def redoPagePitchPosLayout(self):
        r"""redoPagePitchPosLayout(toolkit self)"""
        return _verovio.toolkit_redoPagePitchPosLayout(self)

    def renderToDeviceContext(self, pageNo, deviceContext):
        r"""renderToDeviceContext(toolkit self, int pageNo, DeviceContext * deviceContext) -> bool"""
        return _verovio.toolkit_renderToDeviceContext(self, pageNo, deviceContext)

    def getHumdrum(self, *args):
        r"""
        getHumdrum(toolkit self) -> std::string
        getHumdrum(toolkit self, std::ostream & output)
        """
        return _verovio.toolkit_getHumdrum(self, *args)

    def setHumdrumBuffer(self, contents):
        r"""setHumdrumBuffer(toolkit self, char const * contents)"""
        return _verovio.toolkit_setHumdrumBuffer(self, contents)

    def getHumdrumBuffer(self):
        r"""getHumdrumBuffer(toolkit self) -> char const *"""
        return _verovio.toolkit_getHumdrumBuffer(self)

    def clearHumdrumBuffer(self):
        r"""clearHumdrumBuffer(toolkit self)"""
        return _verovio.toolkit_clearHumdrumBuffer(self)

    def setInputFrom(self, *args):
        r"""
        setInputFrom(toolkit self, std::string const & inputFrom) -> bool
        setInputFrom(toolkit self, FileFormat format)
        """
        return _verovio.toolkit_setInputFrom(self, *args)

    def getInputFrom(self):
        r"""getInputFrom(toolkit self) -> int"""
        return _verovio.toolkit_getInputFrom(self)

    def getOutputTo(self):
        r"""getOutputTo(toolkit self) -> int"""
        return _verovio.toolkit_getOutputTo(self)

    def initClock(self):
        r"""initClock(toolkit self)"""
        return _verovio.toolkit_initClock(self)

    def resetClock(self):
        r"""resetClock(toolkit self)"""
        return _verovio.toolkit_resetClock(self)

    def getRuntimeInSeconds(self):
        r"""getRuntimeInSeconds(toolkit self) -> double"""
        return _verovio.toolkit_getRuntimeInSeconds(self)

    def logRuntime(self):
        r"""logRuntime(toolkit self)"""
        return _verovio.toolkit_logRuntime(self)

# Register toolkit in _verovio:
_verovio.toolkit_swigregister(toolkit)

UNKNOWN = _verovio.UNKNOWN

AUTO = _verovio.AUTO

MEI = _verovio.MEI

HUMDRUM = _verovio.HUMDRUM

HUMMEI = _verovio.HUMMEI

HUMMIDI = _verovio.HUMMIDI

PAE = _verovio.PAE

ABC = _verovio.ABC

DARMS = _verovio.DARMS

MUSICXML = _verovio.MUSICXML

MUSICXMLHUM = _verovio.MUSICXMLHUM

MEIHUM = _verovio.MEIHUM

MUSEDATAHUM = _verovio.MUSEDATAHUM

ESAC = _verovio.ESAC

MIDI = _verovio.MIDI

TIMEMAP = _verovio.TIMEMAP

EXPANSIONMAP = _verovio.EXPANSIONMAP

LOG_OFF = _verovio.LOG_OFF

LOG_ERROR = _verovio.LOG_ERROR

LOG_WARNING = _verovio.LOG_WARNING

LOG_INFO = _verovio.LOG_INFO

LOG_DEBUG = _verovio.LOG_DEBUG


def setDefaultResourcePath(path):
    r"""setDefaultResourcePath(std::string const & path)"""
    return _verovio.setDefaultResourcePath(path)

def enableLog(level):
    r"""enableLog(vrv::LogLevel level)"""
    return _verovio.enableLog(level)

def enableLogToBuffer(value):
    r"""enableLogToBuffer(bool value)"""
    return _verovio.enableLogToBuffer(value)


