# Copyright © 2025 GlacieTeam.All rights reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
# of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# SPDX-License-Identifier: MPL-2.0

from abc import ABC, abstractmethod
from rapidnbt._NBT.tag_type import TagType
from rapidnbt._NBT.snbt_format import SnbtFormat, SnbtNumberFormat

class Tag(ABC):
    """
    Base class for all NBT tags
    """

    @staticmethod
    def new_tag(type: TagType) -> Tag:
        """
        Create a new tag of the given type
        """

    def __eq__(self, other: Tag) -> bool:
        """
        Compare two tags for equality
        """

    def __hash__(self) -> int:
        """
        Compute hash value for Python hashing operations
        """

    def __repr__(self) -> str:
        """
        Official string representation
        """

    def __str__(self) -> str:
        """
        String representation (SNBT minimized format)
        """

    @abstractmethod
    def copy(self) -> Tag:
        """
        Create a deep copy of this tag
        """

    @abstractmethod
    def equals(self, other: Tag) -> bool:
        """
        Check if this tag equals another tag
        """

    @abstractmethod
    def get_type(self) -> TagType:
        """
        Get the type of this tag
        """

    @abstractmethod
    def hash(self) -> int:
        """
        Compute hash value of this tag
        """

    @abstractmethod
    def load(self, stream: ...) -> None:
        """
        Load tag from binary stream
        """

    @abstractmethod
    def write(self, stream: ...) -> None:
        """
        Write tag to binary stream
        """

    def to_json(self, indent: int = 4) -> str:
        """
        Convert tag to JSON string
        """

    def to_snbt(
        self,
        format: SnbtFormat = SnbtFormat.Default,
        indent: int = 4,
        number_format: SnbtNumberFormat = SnbtNumberFormat.Decimal,
    ) -> str:
        """
        Convert tag to SNBT string
        """
