module Deontic.Civil.CoOwnership () where
import qualified Data.Set as Set
import Deontic.Core.Types
import Deontic.Core.Verdict
import Deontic.Core.Adjudicate
import Deontic.Core.Layer (Base, Resolvable)
import Deontic.Civil.Types
type instance Resolvable CoOwnershipAct = '[Base]
instance Adjudicate CoOwnershipAct '[Base] where
adjudicate :: CoOwnershipAct -> Facts CoOwnershipAct -> Judgment '[Base]
adjudicate CoOwnershipAct
_ Facts CoOwnershipAct
facts
| (PersonId -> Bool) -> [PersonId] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (PersonId -> Set PersonId -> Bool
forall a. Ord a => a -> Set a -> Bool
`Set.member` CoOwnershipFacts -> Set PersonId
cofConsented Facts CoOwnershipAct
CoOwnershipFacts
facts) (CoOwnershipFacts -> [PersonId]
cofOwners Facts CoOwnershipAct
CoOwnershipFacts
facts) =
Verdict -> ArticleRef -> Text -> Judgment '[Base]
forall l. Verdict -> ArticleRef -> Text -> Judgment '[l]
JBase Verdict
Valid
(Text -> Int -> Maybe Int -> ArticleRef
ArticleRef Text
"민법" Int
264 Maybe Int
forall a. Maybe a
Nothing)
Text
"공유물의 처분 또는 변경에 관하여 공유자 전원의 동의가 있다."
| Bool
otherwise =
Verdict -> ArticleRef -> Text -> Judgment '[Base]
forall l. Verdict -> ArticleRef -> Text -> Judgment '[l]
JBase Verdict
Void
(Text -> Int -> Maybe Int -> ArticleRef
ArticleRef Text
"민법" Int
264 Maybe Int
forall a. Maybe a
Nothing)
Text
"공유자 전원의 동의가 없으므로 공유물의 처분 또는 변경은 무효이다."