/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2024 Mike Robeson [dijksterhuis]
*/

use std::error::Error;

/// Global error variants
#[derive(Debug, PartialEq, Eq)]
pub enum OtToolsIoErrors {
    /// An 'Options' Enum (e.g. [`crate::projects::slots::SlotType`]) does not have a matching variant for this value
    NoMatchingOptionEnumValue,
    /// Could not parse a sample slot string data when loading a project
    ProjectSampleSlotParsingError,
    /// A file does not exist at the provided location
    FileNotFound,
    /// I know an error exists here, but I'm busy yak shaving something else at the moment.
    TodoError,
}
impl std::fmt::Display for OtToolsIoErrors {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Self::NoMatchingOptionEnumValue => {
                write!(f, "no matching enum option for the provided value")
            }
            Self::ProjectSampleSlotParsingError => {
                write!(f, "count not load sample slot from project string data")
            }
            Self::FileNotFound => {
                write!(f, "file not found")
            }
            Self::TodoError => {
                write!(
                    f,
                    "this error is handled, but an error variant is not created yet"
                )
            }
        }
    }
}
impl Error for OtToolsIoErrors {}
