use accesskit::Role;
use pyo3::prelude::*;

#[pyclass(name = "Role", eq, frozen)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum PyRole {
    Button,
    CheckBox,
    RadioButton,
    Switch,
    Slider,
    SpinButton,
    ComboBox,
    EditableComboBox,
    TextInput,
    MultilineTextInput,
    PasswordInput,
    SearchInput,
    GenericContainer,
    Group,
    List,
    ListItem,
    ListBox,
    ListBoxOption,
    Menu,
    MenuBar,
    MenuItem,
    MenuItemCheckBox,
    MenuItemRadio,
    Link,
    Navigation,
    Tab,
    TabList,
    TabPanel,
    Toolbar,
    Image,
    Label,
    Heading,
    Paragraph,
    Article,
    Section,
    Figure,
    FigureCaption,
    Blockquote,
    Table,
    Row,
    RowGroup,
    Cell,
    RowHeader,
    ColumnHeader,
    Grid,
    Document,
    Main,
    Header,
    Footer,
    Complementary,
    ContentInfo,
    Banner,
    Form,
    Dialog,
    AlertDialog,
    Alert,
    ProgressIndicator,
    Meter,
    Status,
    Timer,
    Tree,
    TreeItem,
    TreeGrid,
    ScrollBar,
    ScrollView,
    Tooltip,
    Log,
    Marquee,
    Note,
    Region,
    Search,
    Splitter,
    Window,
    Application,
    Canvas,
    GraphicsDocument,
    GraphicsObject,
    GraphicsSymbol,
    SvgRoot,
    Unknown,
}

impl From<PyRole> for Role {
    fn from(role: PyRole) -> Self {
        match role {
            PyRole::Button => Role::Button,
            PyRole::CheckBox => Role::CheckBox,
            PyRole::RadioButton => Role::RadioButton,
            PyRole::Switch => Role::Switch,
            PyRole::Slider => Role::Slider,
            PyRole::SpinButton => Role::SpinButton,
            PyRole::ComboBox => Role::ComboBox,
            PyRole::EditableComboBox => Role::EditableComboBox,
            PyRole::TextInput => Role::TextInput,
            PyRole::MultilineTextInput => Role::MultilineTextInput,
            PyRole::PasswordInput => Role::PasswordInput,
            PyRole::SearchInput => Role::SearchInput,
            PyRole::GenericContainer => Role::GenericContainer,
            PyRole::Group => Role::Group,
            PyRole::List => Role::List,
            PyRole::ListItem => Role::ListItem,
            PyRole::ListBox => Role::ListBox,
            PyRole::ListBoxOption => Role::ListBoxOption,
            PyRole::Menu => Role::Menu,
            PyRole::MenuBar => Role::MenuBar,
            PyRole::MenuItem => Role::MenuItem,
            PyRole::MenuItemCheckBox => Role::MenuItemCheckBox,
            PyRole::MenuItemRadio => Role::MenuItemRadio,
            PyRole::Link => Role::Link,
            PyRole::Navigation => Role::Navigation,
            PyRole::Tab => Role::Tab,
            PyRole::TabList => Role::TabList,
            PyRole::TabPanel => Role::TabPanel,
            PyRole::Toolbar => Role::Toolbar,
            PyRole::Image => Role::Image,
            PyRole::Label => Role::Label,
            PyRole::Heading => Role::Heading,
            PyRole::Paragraph => Role::Paragraph,
            PyRole::Article => Role::Article,
            PyRole::Section => Role::Section,
            PyRole::Figure => Role::Figure,
            PyRole::FigureCaption => Role::FigureCaption,
            PyRole::Blockquote => Role::Blockquote,
            PyRole::Table => Role::Table,
            PyRole::Row => Role::Row,
            PyRole::RowGroup => Role::RowGroup,
            PyRole::Cell => Role::Cell,
            PyRole::RowHeader => Role::RowHeader,
            PyRole::ColumnHeader => Role::ColumnHeader,
            PyRole::Grid => Role::Grid,
            PyRole::Document => Role::Document,
            PyRole::Main => Role::Main,
            PyRole::Header => Role::Header,
            PyRole::Footer => Role::Footer,
            PyRole::Complementary => Role::Complementary,
            PyRole::ContentInfo => Role::ContentInfo,
            PyRole::Banner => Role::Banner,
            PyRole::Form => Role::Form,
            PyRole::Dialog => Role::Dialog,
            PyRole::AlertDialog => Role::AlertDialog,
            PyRole::Alert => Role::Alert,
            PyRole::ProgressIndicator => Role::ProgressIndicator,
            PyRole::Meter => Role::Meter,
            PyRole::Status => Role::Status,
            PyRole::Timer => Role::Timer,
            PyRole::Tree => Role::Tree,
            PyRole::TreeItem => Role::TreeItem,
            PyRole::TreeGrid => Role::TreeGrid,
            PyRole::ScrollBar => Role::ScrollBar,
            PyRole::ScrollView => Role::ScrollView,
            PyRole::Tooltip => Role::Tooltip,
            PyRole::Log => Role::Log,
            PyRole::Marquee => Role::Marquee,
            PyRole::Note => Role::Note,
            PyRole::Region => Role::Region,
            PyRole::Search => Role::Search,
            PyRole::Splitter => Role::Splitter,
            PyRole::Window => Role::Window,
            PyRole::Application => Role::Application,
            PyRole::Canvas => Role::Canvas,
            PyRole::GraphicsDocument => Role::GraphicsDocument,
            PyRole::GraphicsObject => Role::GraphicsObject,
            PyRole::GraphicsSymbol => Role::GraphicsSymbol,
            PyRole::SvgRoot => Role::SvgRoot,
            PyRole::Unknown => Role::Unknown,
        }
    }
}

impl From<Role> for PyRole {
    fn from(role: Role) -> Self {
        match role {
            Role::Button => PyRole::Button,
            Role::CheckBox => PyRole::CheckBox,
            Role::RadioButton => PyRole::RadioButton,
            Role::Switch => PyRole::Switch,
            Role::Slider => PyRole::Slider,
            Role::SpinButton => PyRole::SpinButton,
            Role::ComboBox => PyRole::ComboBox,
            Role::EditableComboBox => PyRole::EditableComboBox,
            Role::TextInput => PyRole::TextInput,
            Role::MultilineTextInput => PyRole::MultilineTextInput,
            Role::PasswordInput => PyRole::PasswordInput,
            Role::SearchInput => PyRole::SearchInput,
            Role::GenericContainer => PyRole::GenericContainer,
            Role::Group => PyRole::Group,
            Role::List => PyRole::List,
            Role::ListItem => PyRole::ListItem,
            Role::ListBox => PyRole::ListBox,
            Role::ListBoxOption => PyRole::ListBoxOption,
            Role::Menu => PyRole::Menu,
            Role::MenuBar => PyRole::MenuBar,
            Role::MenuItem => PyRole::MenuItem,
            Role::MenuItemCheckBox => PyRole::MenuItemCheckBox,
            Role::MenuItemRadio => PyRole::MenuItemRadio,
            Role::Link => PyRole::Link,
            Role::Navigation => PyRole::Navigation,
            Role::Tab => PyRole::Tab,
            Role::TabList => PyRole::TabList,
            Role::TabPanel => PyRole::TabPanel,
            Role::Toolbar => PyRole::Toolbar,
            Role::Image => PyRole::Image,
            Role::Label => PyRole::Label,
            Role::Heading => PyRole::Heading,
            Role::Paragraph => PyRole::Paragraph,
            Role::Article => PyRole::Article,
            Role::Section => PyRole::Section,
            Role::Figure => PyRole::Figure,
            Role::FigureCaption => PyRole::FigureCaption,
            Role::Blockquote => PyRole::Blockquote,
            Role::Table => PyRole::Table,
            Role::Row => PyRole::Row,
            Role::RowGroup => PyRole::RowGroup,
            Role::Cell => PyRole::Cell,
            Role::RowHeader => PyRole::RowHeader,
            Role::ColumnHeader => PyRole::ColumnHeader,
            Role::Grid => PyRole::Grid,
            Role::Document => PyRole::Document,
            Role::Main => PyRole::Main,
            Role::Header => PyRole::Header,
            Role::Footer => PyRole::Footer,
            Role::Complementary => PyRole::Complementary,
            Role::ContentInfo => PyRole::ContentInfo,
            Role::Banner => PyRole::Banner,
            Role::Form => PyRole::Form,
            Role::Dialog => PyRole::Dialog,
            Role::AlertDialog => PyRole::AlertDialog,
            Role::Alert => PyRole::Alert,
            Role::ProgressIndicator => PyRole::ProgressIndicator,
            Role::Meter => PyRole::Meter,
            Role::Status => PyRole::Status,
            Role::Timer => PyRole::Timer,
            Role::Tree => PyRole::Tree,
            Role::TreeItem => PyRole::TreeItem,
            Role::TreeGrid => PyRole::TreeGrid,
            Role::ScrollBar => PyRole::ScrollBar,
            Role::ScrollView => PyRole::ScrollView,
            Role::Tooltip => PyRole::Tooltip,
            Role::Log => PyRole::Log,
            Role::Marquee => PyRole::Marquee,
            Role::Note => PyRole::Note,
            Role::Region => PyRole::Region,
            Role::Search => PyRole::Search,
            Role::Splitter => PyRole::Splitter,
            Role::Window => PyRole::Window,
            Role::Application => PyRole::Application,
            Role::Canvas => PyRole::Canvas,
            Role::GraphicsDocument => PyRole::GraphicsDocument,
            Role::GraphicsObject => PyRole::GraphicsObject,
            Role::GraphicsSymbol => PyRole::GraphicsSymbol,
            Role::SvgRoot => PyRole::SvgRoot,
            _ => PyRole::Unknown,
        }
    }
}
