# Copyright (C) MatrixEditor 2023-2025
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
from enum import Enum

from caterpillar.abc import _EndianLike, _ArchLike, _SupportsSetEndian, _OT

class ByteOrder(_EndianLike):
    name: str
    ch: str

    class Alignment(Enum):
        NONE = 0
        NATIVE = 1

    alignment: Alignment

    class Size(Enum):
        STANDARD = 0
        NATIVE = 1

    size: Size

    def apply(self, other: ByteOrder) -> None: ...
    def __add__(self, other: _SupportsSetEndian[_OT]) -> _OT: ...
    def __or__(self, other: ByteOrder): ...
    def __init__(
        self,
        name: str,
        ch: str,
        alignment: Alignment | None = ...,
        size: Size | None = ...,
    ) -> None: ...

LITTLE_ENDIAN_FMT: str
Native: ByteOrder = ...
BigEndian: ByteOrder = ...
LittleEndian: ByteOrder = ...
NetEndian: ByteOrder = ...
SysNative: ByteOrder = ...

def byteorder(obj, default: _EndianLike | None = None) -> _EndianLike: ...

class Arch(_ArchLike):
    name: str
    ptr_size: int

    def __init__(self, name: str, ptr_size: int) -> None: ...

system_arch: Arch = ...
x86: Arch = ...
x86_64: Arch = ...
ARM: Arch = ...
ARM64: Arch = ...
AARCH64: Arch = ...
PowerPC: Arch = ...
PowerPC64: Arch = ...
MIPS: Arch = ...
MIPS64: Arch = ...
SPARC: Arch = ...
SPARC64: Arch = ...
RISC_V64: Arch = ...
RISC_V: Arch = ...
AMD: Arch = ...
AMD64: Arch = ...
