{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DuplicateRecordFields #-}
module OTel.API.Baggage.Core.Builder.Errors
  ( BaggageErrors(..)
  , BaggageError(..)
  , BaggageKeyIsEmptyError(..)
  , BaggageKeyContainsInvalidCharsError(..)
  , BaggageValueIsEmptyError(..)
  , BaggageValueContainsInvalidCharsError(..)
  ) where

import Control.Exception.Safe (Exception)
import Data.Text (Text)
import OTel.API.Common (Key)
import Prelude

newtype BaggageErrors = BaggageErrors
  { BaggageErrors -> [BaggageError]
unBaggageErrors :: [BaggageError]
  } deriving stock (BaggageErrors -> BaggageErrors -> Bool
(BaggageErrors -> BaggageErrors -> Bool)
-> (BaggageErrors -> BaggageErrors -> Bool) -> Eq BaggageErrors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BaggageErrors -> BaggageErrors -> Bool
== :: BaggageErrors -> BaggageErrors -> Bool
$c/= :: BaggageErrors -> BaggageErrors -> Bool
/= :: BaggageErrors -> BaggageErrors -> Bool
Eq, Int -> BaggageErrors -> ShowS
[BaggageErrors] -> ShowS
BaggageErrors -> String
(Int -> BaggageErrors -> ShowS)
-> (BaggageErrors -> String)
-> ([BaggageErrors] -> ShowS)
-> Show BaggageErrors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BaggageErrors -> ShowS
showsPrec :: Int -> BaggageErrors -> ShowS
$cshow :: BaggageErrors -> String
show :: BaggageErrors -> String
$cshowList :: [BaggageErrors] -> ShowS
showList :: [BaggageErrors] -> ShowS
Show)
    deriving anyclass (Show BaggageErrors
Typeable BaggageErrors
(Typeable BaggageErrors, Show BaggageErrors) =>
(BaggageErrors -> SomeException)
-> (SomeException -> Maybe BaggageErrors)
-> (BaggageErrors -> String)
-> Exception BaggageErrors
SomeException -> Maybe BaggageErrors
BaggageErrors -> String
BaggageErrors -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: BaggageErrors -> SomeException
toException :: BaggageErrors -> SomeException
$cfromException :: SomeException -> Maybe BaggageErrors
fromException :: SomeException -> Maybe BaggageErrors
$cdisplayException :: BaggageErrors -> String
displayException :: BaggageErrors -> String
Exception)

data BaggageError
  = BaggageKeyIsEmpty BaggageKeyIsEmptyError
  | BaggageKeyContainsInvalidChars BaggageKeyContainsInvalidCharsError
  | BaggageValueIsEmpty BaggageValueIsEmptyError
  | BaggageValueContainsInvalidChars BaggageValueContainsInvalidCharsError
  deriving stock (BaggageError -> BaggageError -> Bool
(BaggageError -> BaggageError -> Bool)
-> (BaggageError -> BaggageError -> Bool) -> Eq BaggageError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BaggageError -> BaggageError -> Bool
== :: BaggageError -> BaggageError -> Bool
$c/= :: BaggageError -> BaggageError -> Bool
/= :: BaggageError -> BaggageError -> Bool
Eq, Int -> BaggageError -> ShowS
[BaggageError] -> ShowS
BaggageError -> String
(Int -> BaggageError -> ShowS)
-> (BaggageError -> String)
-> ([BaggageError] -> ShowS)
-> Show BaggageError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BaggageError -> ShowS
showsPrec :: Int -> BaggageError -> ShowS
$cshow :: BaggageError -> String
show :: BaggageError -> String
$cshowList :: [BaggageError] -> ShowS
showList :: [BaggageError] -> ShowS
Show)

newtype BaggageKeyIsEmptyError = BaggageKeyIsEmptyError
  { BaggageKeyIsEmptyError -> Text
rawValue :: Text
  } deriving stock (BaggageKeyIsEmptyError -> BaggageKeyIsEmptyError -> Bool
(BaggageKeyIsEmptyError -> BaggageKeyIsEmptyError -> Bool)
-> (BaggageKeyIsEmptyError -> BaggageKeyIsEmptyError -> Bool)
-> Eq BaggageKeyIsEmptyError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BaggageKeyIsEmptyError -> BaggageKeyIsEmptyError -> Bool
== :: BaggageKeyIsEmptyError -> BaggageKeyIsEmptyError -> Bool
$c/= :: BaggageKeyIsEmptyError -> BaggageKeyIsEmptyError -> Bool
/= :: BaggageKeyIsEmptyError -> BaggageKeyIsEmptyError -> Bool
Eq, Int -> BaggageKeyIsEmptyError -> ShowS
[BaggageKeyIsEmptyError] -> ShowS
BaggageKeyIsEmptyError -> String
(Int -> BaggageKeyIsEmptyError -> ShowS)
-> (BaggageKeyIsEmptyError -> String)
-> ([BaggageKeyIsEmptyError] -> ShowS)
-> Show BaggageKeyIsEmptyError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BaggageKeyIsEmptyError -> ShowS
showsPrec :: Int -> BaggageKeyIsEmptyError -> ShowS
$cshow :: BaggageKeyIsEmptyError -> String
show :: BaggageKeyIsEmptyError -> String
$cshowList :: [BaggageKeyIsEmptyError] -> ShowS
showList :: [BaggageKeyIsEmptyError] -> ShowS
Show)

data BaggageKeyContainsInvalidCharsError = BaggageKeyContainsInvalidCharsError
  { BaggageKeyContainsInvalidCharsError -> Key Text
rawKey :: Key Text
  , BaggageKeyContainsInvalidCharsError -> Text
rawValue :: Text
  , BaggageKeyContainsInvalidCharsError -> Text
invalidChars :: Text
  } deriving stock (BaggageKeyContainsInvalidCharsError
-> BaggageKeyContainsInvalidCharsError -> Bool
(BaggageKeyContainsInvalidCharsError
 -> BaggageKeyContainsInvalidCharsError -> Bool)
-> (BaggageKeyContainsInvalidCharsError
    -> BaggageKeyContainsInvalidCharsError -> Bool)
-> Eq BaggageKeyContainsInvalidCharsError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BaggageKeyContainsInvalidCharsError
-> BaggageKeyContainsInvalidCharsError -> Bool
== :: BaggageKeyContainsInvalidCharsError
-> BaggageKeyContainsInvalidCharsError -> Bool
$c/= :: BaggageKeyContainsInvalidCharsError
-> BaggageKeyContainsInvalidCharsError -> Bool
/= :: BaggageKeyContainsInvalidCharsError
-> BaggageKeyContainsInvalidCharsError -> Bool
Eq, Int -> BaggageKeyContainsInvalidCharsError -> ShowS
[BaggageKeyContainsInvalidCharsError] -> ShowS
BaggageKeyContainsInvalidCharsError -> String
(Int -> BaggageKeyContainsInvalidCharsError -> ShowS)
-> (BaggageKeyContainsInvalidCharsError -> String)
-> ([BaggageKeyContainsInvalidCharsError] -> ShowS)
-> Show BaggageKeyContainsInvalidCharsError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BaggageKeyContainsInvalidCharsError -> ShowS
showsPrec :: Int -> BaggageKeyContainsInvalidCharsError -> ShowS
$cshow :: BaggageKeyContainsInvalidCharsError -> String
show :: BaggageKeyContainsInvalidCharsError -> String
$cshowList :: [BaggageKeyContainsInvalidCharsError] -> ShowS
showList :: [BaggageKeyContainsInvalidCharsError] -> ShowS
Show)

newtype BaggageValueIsEmptyError = BaggageValueIsEmptyError
  { BaggageValueIsEmptyError -> Key Text
rawKey :: Key Text
  } deriving stock (BaggageValueIsEmptyError -> BaggageValueIsEmptyError -> Bool
(BaggageValueIsEmptyError -> BaggageValueIsEmptyError -> Bool)
-> (BaggageValueIsEmptyError -> BaggageValueIsEmptyError -> Bool)
-> Eq BaggageValueIsEmptyError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BaggageValueIsEmptyError -> BaggageValueIsEmptyError -> Bool
== :: BaggageValueIsEmptyError -> BaggageValueIsEmptyError -> Bool
$c/= :: BaggageValueIsEmptyError -> BaggageValueIsEmptyError -> Bool
/= :: BaggageValueIsEmptyError -> BaggageValueIsEmptyError -> Bool
Eq, Int -> BaggageValueIsEmptyError -> ShowS
[BaggageValueIsEmptyError] -> ShowS
BaggageValueIsEmptyError -> String
(Int -> BaggageValueIsEmptyError -> ShowS)
-> (BaggageValueIsEmptyError -> String)
-> ([BaggageValueIsEmptyError] -> ShowS)
-> Show BaggageValueIsEmptyError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BaggageValueIsEmptyError -> ShowS
showsPrec :: Int -> BaggageValueIsEmptyError -> ShowS
$cshow :: BaggageValueIsEmptyError -> String
show :: BaggageValueIsEmptyError -> String
$cshowList :: [BaggageValueIsEmptyError] -> ShowS
showList :: [BaggageValueIsEmptyError] -> ShowS
Show)

data BaggageValueContainsInvalidCharsError = BaggageValueContainsInvalidCharsError
  { BaggageValueContainsInvalidCharsError -> Key Text
rawKey :: Key Text
  , BaggageValueContainsInvalidCharsError -> Text
rawValue :: Text
  , BaggageValueContainsInvalidCharsError -> Text
invalidChars :: Text
  } deriving stock (BaggageValueContainsInvalidCharsError
-> BaggageValueContainsInvalidCharsError -> Bool
(BaggageValueContainsInvalidCharsError
 -> BaggageValueContainsInvalidCharsError -> Bool)
-> (BaggageValueContainsInvalidCharsError
    -> BaggageValueContainsInvalidCharsError -> Bool)
-> Eq BaggageValueContainsInvalidCharsError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BaggageValueContainsInvalidCharsError
-> BaggageValueContainsInvalidCharsError -> Bool
== :: BaggageValueContainsInvalidCharsError
-> BaggageValueContainsInvalidCharsError -> Bool
$c/= :: BaggageValueContainsInvalidCharsError
-> BaggageValueContainsInvalidCharsError -> Bool
/= :: BaggageValueContainsInvalidCharsError
-> BaggageValueContainsInvalidCharsError -> Bool
Eq, Int -> BaggageValueContainsInvalidCharsError -> ShowS
[BaggageValueContainsInvalidCharsError] -> ShowS
BaggageValueContainsInvalidCharsError -> String
(Int -> BaggageValueContainsInvalidCharsError -> ShowS)
-> (BaggageValueContainsInvalidCharsError -> String)
-> ([BaggageValueContainsInvalidCharsError] -> ShowS)
-> Show BaggageValueContainsInvalidCharsError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BaggageValueContainsInvalidCharsError -> ShowS
showsPrec :: Int -> BaggageValueContainsInvalidCharsError -> ShowS
$cshow :: BaggageValueContainsInvalidCharsError -> String
show :: BaggageValueContainsInvalidCharsError -> String
$cshowList :: [BaggageValueContainsInvalidCharsError] -> ShowS
showList :: [BaggageValueContainsInvalidCharsError] -> ShowS
Show)