from __future__ import annotations
import collections.abc
import datetime
import typing
from warnings import deprecated # type: ignore

import jpype # type: ignore
import jpype.protocol # type: ignore

import ghidra.program.model.data
import java.lang # type: ignore
import java.util # type: ignore


T = typing.TypeVar("T")


class DataTypeMerger(java.lang.Object, typing.Generic[T]):
    """
    Base class for datatype mergers. Note that these mergers are non interactive and can only
    merge datatypes that have no conflicting internal components or settings.
    
    
    The basic pattern is to create a merger with the two datatypes to be merged and then call
    the :meth:`merge() <.merge>` method to produce the new datatype that is the merger of the two original
    datatypes. The new datatype will have the same name and category path of the first original 
    datatype. 
    
    
    Even if the merge is able to successfully complete and return a new datatype, the merge may
    have associated warnings that can be retrieved by calling :meth:`getWarnings() <.getWarnings>`. The intent
    is that the warning messages can be presented to the user before applying the new datatype.
    
    
    Typically, after merging the two datatypes, the client will replace the first datatype with
    the merged datatype (it already has the same name and category). Then all uses of the second
    datatype will be replaced with updated first datatype.
    """

    class_: typing.ClassVar[java.lang.Class]

    def getWarnings(self) -> java.util.List[java.lang.String]:
        """
        :return: any warnings that were generated by a call to the merge() method
        :rtype: java.util.List[java.lang.String]
        """

    def hasWarnings(self) -> bool:
        """
        :return: true if there are any warnings
        :rtype: bool
        """

    def merge(self) -> T:
        """
        Merge the two datatypes that this object was created with into a new datatype.
        
        :return: the the new merged datatype.
        :rtype: T
        :raises DataTypeMergeException: thrown if the merge was unable to complete due to some
        conflict.
        """

    @property
    def warnings(self) -> java.util.List[java.lang.String]:
        ...


class DataTypeMergeException(java.lang.Exception):
    """
    Exception thrown when an error occurs when attempting to merge two datatypes.
    """

    class_: typing.ClassVar[java.lang.Class]

    def __init__(self, message: typing.Union[java.lang.String, str]) -> None:
        ...


class EnumMerger(DataTypeMerger[ghidra.program.model.data.Enum]):
    """
    Datatype merger for Enums.
    """

    class_: typing.ClassVar[java.lang.Class]

    def __init__(self, enum1: ghidra.program.model.data.Enum, enum2: ghidra.program.model.data.Enum) -> None:
        ...


class StructureMerger(DataTypeMerger[ghidra.program.model.data.Structure]):
    """
    DataType merger for structures.
    """

    class_: typing.ClassVar[java.lang.Class]

    @typing.overload
    def __init__(self, struct1: ghidra.program.model.data.Structure, struct2: ghidra.program.model.data.Structure) -> None:
        ...

    @typing.overload
    def __init__(self, struct1: ghidra.program.model.data.Structure, struct2: ghidra.program.model.data.Structure, terminateOnError: typing.Union[jpype.JBoolean, bool]) -> None:
        ...


class UnionMerger(DataTypeMerger[ghidra.program.model.data.Union]):
    """
    Datatype merger for Unions
    """

    class_: typing.ClassVar[java.lang.Class]

    def __init__(self, union1: ghidra.program.model.data.Union, union2: ghidra.program.model.data.Union) -> None:
        ...



__all__ = ["DataTypeMerger", "DataTypeMergeException", "EnumMerger", "StructureMerger", "UnionMerger"]
