from typing import Tuple, Iterable, Iterator, Union, overload
from .color import BaseColor
from .hex import Hex
from .hsv import HSV

class RGB(BaseColor):
    # --- Constructor ---
    @overload
    def __init__(self) -> None: ...
    @overload
    def __init__(self, arg: Union["RGB", str, Iterable[int]]) -> None: ...
    @overload
    def __init__(self, r: int, g: int, b: int) -> None: ...
    def __init__(self, *args) -> None: ...
    
    # === SINGLE COMPONENT ACCESS ===
    # Basic properties (with setters)
    @property
    def r(self) -> int: ...
    @r.setter
    def r(self, value: int) -> None: ...
    
    @property
    def g(self) -> int: ...
    @g.setter
    def g(self, value: int) -> None: ...
    
    @property
    def b(self) -> int: ...
    @b.setter
    def b(self, value: int) -> None: ...
    
    # === TWO-COMPONENT SWIZZLES ===
    # All 2-char permutations
    @property
    def rg(self) -> Tuple[int, int]: ...
    @rg.setter
    def rg(self, value: Iterable[int]) -> None: ...
    
    @property
    def rb(self) -> Tuple[int, int]: ...
    @rb.setter
    def rb(self, value: Iterable[int]) -> None: ...
    
    @property
    def gr(self) -> Tuple[int, int]: ...
    @gr.setter
    def gr(self, value: Iterable[int]) -> None: ...
    
    @property
    def gb(self) -> Tuple[int, int]: ...
    @gb.setter
    def gb(self, value: Iterable[int]) -> None: ...
    
    @property
    def br(self) -> Tuple[int, int]: ...
    @br.setter
    def br(self, value: Iterable[int]) -> None: ...
    
    @property
    def bg(self) -> Tuple[int, int]: ...
    @bg.setter
    def bg(self, value: Iterable[int]) -> None: ...
    
    # Repeated 2-char patterns
    @property
    def rr(self) -> Tuple[int, int]: ...
    
    @property
    def gg(self) -> Tuple[int, int]: ...
    
    @property
    def bb(self) -> Tuple[int, int]: ...
    
    # === THREE-COMPONENT SWIZZLES ===
    # All 3-char permutations
    @property
    def rgb(self) -> Tuple[int, int, int]: ...
    @rgb.setter
    def rgb(self, value: Iterable[int]) -> None: ...
    
    @property
    def rbg(self) -> Tuple[int, int, int]: ...
    @rbg.setter
    def rbg(self, value: Iterable[int]) -> None: ...
    
    @property
    def grb(self) -> Tuple[int, int, int]: ...
    @grb.setter
    def grb(self, value: Iterable[int]) -> None: ...
    
    @property
    def gbr(self) -> Tuple[int, int, int]: ...
    @gbr.setter
    def gbr(self, value: Iterable[int]) -> None: ...
    
    @property
    def brg(self) -> Tuple[int, int, int]: ...
    @brg.setter
    def brg(self, value: Iterable[int]) -> None: ...
    
    @property
    def bgr(self) -> Tuple[int, int, int]: ...
    @bgr.setter
    def bgr(self, value: Iterable[int]) -> None: ...
    
    # Repeated 3-char patterns
    @property
    def rrr(self) -> Tuple[int, int, int]: ...
    
    @property
    def ggg(self) -> Tuple[int, int, int]: ...
    
    @property
    def bbb(self) -> Tuple[int, int, int]: ...
    
    # Mixed repeated patterns (common ones)
    @property
    def rrg(self) -> Tuple[int, int, int]: ...
    
    @property
    def rgg(self) -> Tuple[int, int, int]: ...
    
    @property
    def rrb(self) -> Tuple[int, int, int]: ...
    
    @property
    def rbb(self) -> Tuple[int, int, int]: ...
    
    @property
    def ggr(self) -> Tuple[int, int, int]: ...
    
    @property
    def grr(self) -> Tuple[int, int, int]: ...
    
    @property
    def ggb(self) -> Tuple[int, int, int]: ...
    
    @property
    def gbb(self) -> Tuple[int, int, int]: ...
    
    @property
    def bbr(self) -> Tuple[int, int, int]: ...
    
    @property
    def brr(self) -> Tuple[int, int, int]: ...

    @property
    def brb(self) -> Tuple[int, int, int]: ...
    
    @property
    def bbg(self) -> Tuple[int, int, int]: ...
    
    @property
    def bgg(self) -> Tuple[int, int, int]: ...

    # --- Immutable convenience methods ---
    def with_red(self, r: int) -> "RGB": ...
    def with_green(self, g: int) -> "RGB": ...
    def with_blue(self, b: int) -> "RGB": ...

    # --- Conversion methods ---
    def to_rgb(self) -> "RGB": ...
    def to_hex(self) -> Hex: ...
    def to_tuple(self) -> Tuple[int, int, int]: ...
    def to_list(self) -> list[int]: ...
    def normalized(self) -> Tuple[float, float, float]: ...
    def to_hsv(self) -> HSV: ...

    # --- Alternate constructors ---
    @classmethod
    def from_hex(cls, hex_string: str) -> "RGB": ...
    @classmethod
    def from_normalized(cls, r: float, g: float, b: float) -> "RGB": ...
    @classmethod
    def random(cls) -> 'RGB': ...

    # --- Sequence protocol ---
    def __iter__(self) -> Iterator[int]: ...
    def __getitem__(self, index: int) -> int: ...
    def __len__(self) -> int: ...

    # --- String representations ---
    def __str__(self) -> str: ...
    def __repr__(self) -> str: ...

    # --- Equality & hashing ---
    def __eq__(self, other: object) -> bool: ...
    def __hash__(self) -> int: ...