# styles/styled_widgets.py
from PySide6.QtWidgets import QLabel, QLineEdit, QPushButton, QCheckBox
from .style_manager import StyleManager


class StyledLabel(QLabel):
    def __init__(self, text="", style_type="default", parent=None):
        super().__init__(text, parent)
        self.style_type = style_type
        self.set_style(style_type)

    def set_style(self, style_type=None):
        if style_type:
            self.style_type = style_type
        self.setStyleSheet(StyleManager.get_label_style(self.style_type))


class StyledLineEdit(QLineEdit):
    def __init__(self, placeholder="", style_type="default", parent=None):
        super().__init__(parent)
        self.style_type = style_type
        self.set_style(style_type)
        if placeholder:
            self.setPlaceholderText(placeholder)
        self.setMinimumHeight(35)

    def set_style(self, style_type=None):
        if style_type:
            self.style_type = style_type
        self.setStyleSheet(StyleManager.get_input_style(self.style_type))


class StyledPushButton(QPushButton):
    def __init__(self, text="", style_type="default", button_type="primary", parent=None):
        super().__init__(text, parent)
        self.style_type = style_type
        self.button_type = button_type
        self.set_style(style_type, button_type)
        self.setMinimumHeight(40)

    def set_style(self, style_type=None, button_type=None):
        if style_type:
            self.style_type = style_type
        if button_type:
            self.button_type = button_type
        self.setStyleSheet(StyleManager.get_button_style(self.style_type, self.button_type))


class StyledCheckBox(QCheckBox):
    def __init__(self, text="", style_type="default", parent=None):
        super().__init__(text, parent)
        self.style_type = style_type
        self.set_style(style_type)

    def set_style(self, style_type=None):
        if style_type:
            self.style_type = style_type
        self.setStyleSheet(StyleManager.get_checkbox_style(self.style_type))
