"""Type stubs for rshogi.types — basic shogi types and constants."""

from __future__ import annotations


class Color:
    BLACK: Color
    WHITE: Color
    def __init__(self, value: int | None = ...) -> None: ...
    @classmethod
    def from_usi(cls, usi: str) -> Color: ...
    def flip(self) -> Color: ...
    def is_black(self) -> bool: ...
    def is_white(self) -> bool: ...
    @property
    def value(self) -> int: ...
    def __int__(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


class PieceType:
    NO_PIECE_TYPE: PieceType
    PAWN: PieceType
    LANCE: PieceType
    KNIGHT: PieceType
    SILVER: PieceType
    BISHOP: PieceType
    ROOK: PieceType
    GOLD: PieceType
    KING: PieceType
    PRO_PAWN: PieceType
    PRO_LANCE: PieceType
    PRO_KNIGHT: PieceType
    PRO_SILVER: PieceType
    HORSE: PieceType
    DRAGON: PieceType
    GOLD_LIKE: PieceType
    def __init__(self, value: int | None = ...) -> None: ...
    @classmethod
    def from_usi(cls, usi: str) -> PieceType: ...
    def is_promotable(self) -> bool: ...
    def is_promoted(self) -> bool: ...
    def promote(self) -> PieceType: ...
    def demote(self) -> PieceType: ...
    def to_usi(self) -> str: ...
    @property
    def value(self) -> int: ...
    def __int__(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


class Piece:
    def __init__(self, value: int | None = ...) -> None: ...
    @classmethod
    def from_color_type(cls, color: Color, piece_type: PieceType) -> Piece: ...
    @classmethod
    def from_usi(cls, usi: str) -> Piece: ...
    @property
    def color(self) -> Color: ...
    @property
    def piece_type(self) -> PieceType: ...
    def is_promoted(self) -> bool: ...
    def promote(self) -> Piece: ...
    def unpromoted_piece(self) -> Piece: ...
    def base_piece_type(self) -> PieceType: ...
    @property
    def value(self) -> int: ...
    def __int__(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


class Square:
    NONE: Square
    def __init__(self, value: int | None = ...) -> None: ...
    @classmethod
    def from_usi(cls, usi: str) -> Square: ...
    @classmethod
    def from_index(cls, idx: int) -> Square: ...
    def to_usi(self) -> str: ...
    def is_valid(self) -> bool: ...
    def is_none(self) -> bool: ...
    def mirror_file(self) -> Square: ...
    def flip_side(self) -> Square: ...
    @property
    def value(self) -> int: ...
    @property
    def file(self) -> int: ...
    @property
    def rank(self) -> int: ...
    def __int__(self) -> int: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


class Bitboard:
    EMPTY: Bitboard
    ALL: Bitboard
    def __init__(self) -> None: ...
    @classmethod
    def from_parts(cls, low: int, high: int) -> Bitboard: ...
    @classmethod
    def from_square(cls, square: Square) -> Bitboard: ...
    @property
    def packed(self) -> int: ...
    @property
    def parts(self) -> tuple[int, int]: ...
    def is_empty(self) -> bool: ...
    def count(self) -> int: ...
    def set(self, square: Square) -> None: ...
    def clear(self, square: Square) -> None: ...
    def test(self, square: Square) -> bool: ...
    def flip_side(self) -> Bitboard: ...
    def mirror_file(self) -> Bitboard: ...
    def pop_lsb(self) -> Square | None: ...
    def __int__(self) -> int: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


class Hand:
    ZERO: Hand
    def __init__(self) -> None: ...
    def count(self, piece_type: PieceType) -> int: ...
    def add(self, piece_type: PieceType, amount: int | None = ...) -> None: ...
    def sub(self, piece_type: PieceType, amount: int | None = ...) -> None: ...
    def is_empty(self) -> bool: ...
    @property
    def value(self) -> int: ...
    def __int__(self) -> int: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


class MoveType:
    NORMAL: MoveType
    PROMOTION: MoveType
    DROP: MoveType
    def __init__(self) -> None: ...
    def is_normal(self) -> bool: ...
    def is_promotion(self) -> bool: ...
    def is_drop(self) -> bool: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


class RepetitionState:
    NONE: RepetitionState
    WIN: RepetitionState
    LOSE: RepetitionState
    DRAW: RepetitionState
    SUPERIOR: RepetitionState
    INFERIOR: RepetitionState
    def __init__(self) -> None: ...
    def to_usi(self) -> str: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


__all__ = [
    "Color",
    "PieceType",
    "Piece",
    "Square",
    "Bitboard",
    "Hand",
    "MoveType",
    "RepetitionState",
]
