use thiserror::Error;
use crate::types::enums::object_type::IcingaObjectType;
#[derive(Debug, Error)]
pub enum Error {
#[error("could not read config file: {0}")]
CouldNotReadConfigFile(std::io::Error),
#[error("could not parse config: {0}")]
CouldNotParseConfig(toml::de::Error),
#[error("could not parse URL in config: {0}")]
CouldNotParseUrlInConfig(url::ParseError),
#[error("could not build reqwest client from supplied information: {0}")]
CouldNotBuildReqwestClientFromSuppliedInformation(reqwest::Error),
#[error("could not read CA certificate file: {0}")]
CouldNotReadCACertFile(std::io::Error),
#[error("could not parse PEM CA certificate: {0}")]
CouldNotParsePEMCACertificate(reqwest::Error),
#[error("error in json serialization/deserialization: {0}")]
SerdeJsonError(#[from] serde_path_to_error::Error<serde_json::Error>),
#[error("empty response body with status: {0}")]
EmptyResponseBody(reqwest::StatusCode),
#[error("reqwest error: {0}")]
ReqwestError(#[from] reqwest::Error),
#[error("could not parse URL fragment: {0}")]
CouldNotParseUrlFragment(url::ParseError),
#[error("filter object type expected one of {0:?} but was {1}")]
FilterObjectTypeMismatch(Vec<IcingaObjectType>, IcingaObjectType),
#[error("uninitialized field in builder: {0}")]
UninitializedFieldInBuilder(#[from] derive_builder::UninitializedFieldError),
#[error("all_services is invalid when targeting a service for a downtime")]
AllServicesInvalidOnServiceDowntime,
#[error("duration is required for flexible downtimes")]
DurationRequiredOnFlexibleDowntime,
}