module Deontic.BGB.Types
  ( CapacityAct(..)
  , BGBFact(..)
  , LimitedCapacity
  ) where

import Data.Set (Set)
import Deontic.Core.Types (PersonId, ActId, Facts)

-- | Geschäftsfähigkeit — Capacity to contract (BGB §104-§113)
data CapacityAct = CapacityAct
  { CapacityAct -> PersonId
caActor :: PersonId
  , CapacityAct -> ActId
caActId :: ActId
  } deriving (CapacityAct -> CapacityAct -> Bool
(CapacityAct -> CapacityAct -> Bool)
-> (CapacityAct -> CapacityAct -> Bool) -> Eq CapacityAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CapacityAct -> CapacityAct -> Bool
== :: CapacityAct -> CapacityAct -> Bool
$c/= :: CapacityAct -> CapacityAct -> Bool
/= :: CapacityAct -> CapacityAct -> Bool
Eq, Int -> CapacityAct -> ShowS
[CapacityAct] -> ShowS
CapacityAct -> String
(Int -> CapacityAct -> ShowS)
-> (CapacityAct -> String)
-> ([CapacityAct] -> ShowS)
-> Show CapacityAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CapacityAct -> ShowS
showsPrec :: Int -> CapacityAct -> ShowS
$cshow :: CapacityAct -> String
show :: CapacityAct -> String
$cshowList :: [CapacityAct] -> ShowS
showList :: [CapacityAct] -> ShowS
Show)

-- | Layer token for limited capacity (beschränkte Geschäftsfähigkeit)
data LimitedCapacity  -- §106-§113

-- | BGB-specific facts
data BGBFact
  -- §104 Geschäftsunfähigkeit
  = UnderSeven PersonId           -- unter sieben Jahren
  | PermanentlyIncapable PersonId -- dauerhafte Störung der Geistestätigkeit
  -- §106-§113 beschränkte Geschäftsfähigkeit
  | IsMinor PersonId              -- Minderjährig (7-17)
  | LegalRepConsent PersonId ActId -- Einwilligung des gesetzlichen Vertreters
  | PurelyBeneficial              -- lediglich rechtlichen Vorteil (§107)
  | PocketMoney                   -- Taschengeld (§110)
  deriving (BGBFact -> BGBFact -> Bool
(BGBFact -> BGBFact -> Bool)
-> (BGBFact -> BGBFact -> Bool) -> Eq BGBFact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BGBFact -> BGBFact -> Bool
== :: BGBFact -> BGBFact -> Bool
$c/= :: BGBFact -> BGBFact -> Bool
/= :: BGBFact -> BGBFact -> Bool
Eq, Eq BGBFact
Eq BGBFact =>
(BGBFact -> BGBFact -> Ordering)
-> (BGBFact -> BGBFact -> Bool)
-> (BGBFact -> BGBFact -> Bool)
-> (BGBFact -> BGBFact -> Bool)
-> (BGBFact -> BGBFact -> Bool)
-> (BGBFact -> BGBFact -> BGBFact)
-> (BGBFact -> BGBFact -> BGBFact)
-> Ord BGBFact
BGBFact -> BGBFact -> Bool
BGBFact -> BGBFact -> Ordering
BGBFact -> BGBFact -> BGBFact
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: BGBFact -> BGBFact -> Ordering
compare :: BGBFact -> BGBFact -> Ordering
$c< :: BGBFact -> BGBFact -> Bool
< :: BGBFact -> BGBFact -> Bool
$c<= :: BGBFact -> BGBFact -> Bool
<= :: BGBFact -> BGBFact -> Bool
$c> :: BGBFact -> BGBFact -> Bool
> :: BGBFact -> BGBFact -> Bool
$c>= :: BGBFact -> BGBFact -> Bool
>= :: BGBFact -> BGBFact -> Bool
$cmax :: BGBFact -> BGBFact -> BGBFact
max :: BGBFact -> BGBFact -> BGBFact
$cmin :: BGBFact -> BGBFact -> BGBFact
min :: BGBFact -> BGBFact -> BGBFact
Ord, Int -> BGBFact -> ShowS
[BGBFact] -> ShowS
BGBFact -> String
(Int -> BGBFact -> ShowS)
-> (BGBFact -> String) -> ([BGBFact] -> ShowS) -> Show BGBFact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BGBFact -> ShowS
showsPrec :: Int -> BGBFact -> ShowS
$cshow :: BGBFact -> String
show :: BGBFact -> String
$cshowList :: [BGBFact] -> ShowS
showList :: [BGBFact] -> ShowS
Show)

type instance Facts CapacityAct = Set BGBFact