-- | Korean Civil Act type definitions.
--
-- For the full coverage summary, see "Deontic.Civil".
module Deontic.Civil.Types
  ( MinorAct(..)
  , JuristicAct(..)
  , ShamAct(..)
  , MistakeAct(..)
  , FraudAct(..)
  , AuthAgencyAct(..)
  , UnauthAgencyAct(..)
  , PossessionAct(..)
  , PrescriptionAct(..)
  , CoOwnershipAct(..)
  , TortAct(..)
  , RescissionAct(..)
  , PropertyTransferAct(..)
  , AcqPrescriptionAct(..)
  , DefaultAct(..)
  , WarrantyAct(..)
  , LeaseAct(..)
  , CivilFact(..)
  , PrescriptionFacts(..)
  , CoOwnershipFacts(..)
  , TortFacts(..)
  , RescissionFacts(..)
  , AcqPrescFacts(..)
  , DefaultFacts(..)
  , WarrantyFacts(..)
  , LeaseFacts(..)
  , Ratification, ApparentAuth
  , Presumption, Rebuttal
  , Expiration, Interruption
  , ContributoryNeg
  , FormException
  , ShortPrescription
  , CreditorDefense
  , BuyerKnowledge
  , RenewalRight
  , AgencyWithdrawalAct(..)
  , AgentLiabilityAct(..)
  , PartialInvalidityAct(..)
  , PartialInvalidityFacts(..)
  , CancellableAct(..)
  , CancellationFacts(..)
  , ConstructiveRatificationEvent(..)
  , ConditionalAct(..)
  , ConditionType(..)
  , ConditionState(..)
  , BadFaithKind(..)
  , ConditionalFacts(..)
  , CounterpartyKnowledge
  , HypotheticalIntent, Conversion
  , GeneralRatification, ConstructiveRatification
  , IllegalCondition, BadFaithCondition
  , DomainKey(..)
  , module Data.Time.Calendar
  ) where

import Data.Functor.Identity (Identity(..))
import Data.GADT.Compare (GEq(..), GCompare(..), GOrdering(..))
import Data.GADT.Show (GShow(..))
import Data.Set (Set)
import Data.Time.Calendar (Day, addGregorianYearsClip)
import Data.Type.Equality ((:~:)(..))
import Deontic.Core.Types (PersonId, ActId, Facts)
import Deontic.Core.Verdict (Verdict)

-- | 미성년자의 법률행위 (민법 제5조)
data MinorAct = MinorAct
  { MinorAct -> PersonId
maActor :: PersonId
  , MinorAct -> ActId
maActId :: ActId
  } deriving (MinorAct -> MinorAct -> Bool
(MinorAct -> MinorAct -> Bool)
-> (MinorAct -> MinorAct -> Bool) -> Eq MinorAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MinorAct -> MinorAct -> Bool
== :: MinorAct -> MinorAct -> Bool
$c/= :: MinorAct -> MinorAct -> Bool
/= :: MinorAct -> MinorAct -> Bool
Eq, Int -> MinorAct -> ShowS
[MinorAct] -> ShowS
MinorAct -> String
(Int -> MinorAct -> ShowS)
-> (MinorAct -> String) -> ([MinorAct] -> ShowS) -> Show MinorAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MinorAct -> ShowS
showsPrec :: Int -> MinorAct -> ShowS
$cshow :: MinorAct -> String
show :: MinorAct -> String
$cshowList :: [MinorAct] -> ShowS
showList :: [MinorAct] -> ShowS
Show)

-- | 일반 법률행위 (민법 제103조-제107조)
data JuristicAct = JuristicAct
  { JuristicAct -> PersonId
jaActor :: PersonId
  , JuristicAct -> ActId
jaActId :: ActId
  } deriving (JuristicAct -> JuristicAct -> Bool
(JuristicAct -> JuristicAct -> Bool)
-> (JuristicAct -> JuristicAct -> Bool) -> Eq JuristicAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JuristicAct -> JuristicAct -> Bool
== :: JuristicAct -> JuristicAct -> Bool
$c/= :: JuristicAct -> JuristicAct -> Bool
/= :: JuristicAct -> JuristicAct -> Bool
Eq, Int -> JuristicAct -> ShowS
[JuristicAct] -> ShowS
JuristicAct -> String
(Int -> JuristicAct -> ShowS)
-> (JuristicAct -> String)
-> ([JuristicAct] -> ShowS)
-> Show JuristicAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JuristicAct -> ShowS
showsPrec :: Int -> JuristicAct -> ShowS
$cshow :: JuristicAct -> String
show :: JuristicAct -> String
$cshowList :: [JuristicAct] -> ShowS
showList :: [JuristicAct] -> ShowS
Show)

-- | 통정허위표시 (민법 제108조)
data ShamAct = ShamAct
  { ShamAct -> PersonId
saActor :: PersonId
  , ShamAct -> ActId
saActId :: ActId
  } deriving (ShamAct -> ShamAct -> Bool
(ShamAct -> ShamAct -> Bool)
-> (ShamAct -> ShamAct -> Bool) -> Eq ShamAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShamAct -> ShamAct -> Bool
== :: ShamAct -> ShamAct -> Bool
$c/= :: ShamAct -> ShamAct -> Bool
/= :: ShamAct -> ShamAct -> Bool
Eq, Int -> ShamAct -> ShowS
[ShamAct] -> ShowS
ShamAct -> String
(Int -> ShamAct -> ShowS)
-> (ShamAct -> String) -> ([ShamAct] -> ShowS) -> Show ShamAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShamAct -> ShowS
showsPrec :: Int -> ShamAct -> ShowS
$cshow :: ShamAct -> String
show :: ShamAct -> String
$cshowList :: [ShamAct] -> ShowS
showList :: [ShamAct] -> ShowS
Show)

-- | 착오에 의한 의사표시 (민법 제109조)
data MistakeAct = MistakeAct
  { MistakeAct -> PersonId
mkActor :: PersonId
  , MistakeAct -> ActId
mkActId :: ActId
  } deriving (MistakeAct -> MistakeAct -> Bool
(MistakeAct -> MistakeAct -> Bool)
-> (MistakeAct -> MistakeAct -> Bool) -> Eq MistakeAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MistakeAct -> MistakeAct -> Bool
== :: MistakeAct -> MistakeAct -> Bool
$c/= :: MistakeAct -> MistakeAct -> Bool
/= :: MistakeAct -> MistakeAct -> Bool
Eq, Int -> MistakeAct -> ShowS
[MistakeAct] -> ShowS
MistakeAct -> String
(Int -> MistakeAct -> ShowS)
-> (MistakeAct -> String)
-> ([MistakeAct] -> ShowS)
-> Show MistakeAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MistakeAct -> ShowS
showsPrec :: Int -> MistakeAct -> ShowS
$cshow :: MistakeAct -> String
show :: MistakeAct -> String
$cshowList :: [MistakeAct] -> ShowS
showList :: [MistakeAct] -> ShowS
Show)

-- | 사기·강박에 의한 의사표시 (민법 제110조)
data FraudAct = FraudAct
  { FraudAct -> PersonId
faActor :: PersonId
  , FraudAct -> ActId
faActId :: ActId
  } deriving (FraudAct -> FraudAct -> Bool
(FraudAct -> FraudAct -> Bool)
-> (FraudAct -> FraudAct -> Bool) -> Eq FraudAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FraudAct -> FraudAct -> Bool
== :: FraudAct -> FraudAct -> Bool
$c/= :: FraudAct -> FraudAct -> Bool
/= :: FraudAct -> FraudAct -> Bool
Eq, Int -> FraudAct -> ShowS
[FraudAct] -> ShowS
FraudAct -> String
(Int -> FraudAct -> ShowS)
-> (FraudAct -> String) -> ([FraudAct] -> ShowS) -> Show FraudAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FraudAct -> ShowS
showsPrec :: Int -> FraudAct -> ShowS
$cshow :: FraudAct -> String
show :: FraudAct -> String
$cshowList :: [FraudAct] -> ShowS
showList :: [FraudAct] -> ShowS
Show)

-- | 유권대리 (민법 제114조, 제118조)
data AuthAgencyAct = AuthAgencyAct
  { AuthAgencyAct -> PersonId
aaaPrincipal :: PersonId  -- 본인
  , AuthAgencyAct -> PersonId
aaaAgent     :: PersonId  -- 대리인
  , AuthAgencyAct -> ActId
aaaActId     :: ActId
  } deriving (AuthAgencyAct -> AuthAgencyAct -> Bool
(AuthAgencyAct -> AuthAgencyAct -> Bool)
-> (AuthAgencyAct -> AuthAgencyAct -> Bool) -> Eq AuthAgencyAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AuthAgencyAct -> AuthAgencyAct -> Bool
== :: AuthAgencyAct -> AuthAgencyAct -> Bool
$c/= :: AuthAgencyAct -> AuthAgencyAct -> Bool
/= :: AuthAgencyAct -> AuthAgencyAct -> Bool
Eq, Int -> AuthAgencyAct -> ShowS
[AuthAgencyAct] -> ShowS
AuthAgencyAct -> String
(Int -> AuthAgencyAct -> ShowS)
-> (AuthAgencyAct -> String)
-> ([AuthAgencyAct] -> ShowS)
-> Show AuthAgencyAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AuthAgencyAct -> ShowS
showsPrec :: Int -> AuthAgencyAct -> ShowS
$cshow :: AuthAgencyAct -> String
show :: AuthAgencyAct -> String
$cshowList :: [AuthAgencyAct] -> ShowS
showList :: [AuthAgencyAct] -> ShowS
Show)

-- | 무권대리 (민법 제130조, 제125-129조, 제132조)
data UnauthAgencyAct = UnauthAgencyAct
  { UnauthAgencyAct -> PersonId
uaaPrincipal :: PersonId  -- 본인
  , UnauthAgencyAct -> PersonId
uaaAgent     :: PersonId  -- 대리인
  , UnauthAgencyAct -> ActId
uaaActId     :: ActId
  } deriving (UnauthAgencyAct -> UnauthAgencyAct -> Bool
(UnauthAgencyAct -> UnauthAgencyAct -> Bool)
-> (UnauthAgencyAct -> UnauthAgencyAct -> Bool)
-> Eq UnauthAgencyAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UnauthAgencyAct -> UnauthAgencyAct -> Bool
== :: UnauthAgencyAct -> UnauthAgencyAct -> Bool
$c/= :: UnauthAgencyAct -> UnauthAgencyAct -> Bool
/= :: UnauthAgencyAct -> UnauthAgencyAct -> Bool
Eq, Int -> UnauthAgencyAct -> ShowS
[UnauthAgencyAct] -> ShowS
UnauthAgencyAct -> String
(Int -> UnauthAgencyAct -> ShowS)
-> (UnauthAgencyAct -> String)
-> ([UnauthAgencyAct] -> ShowS)
-> Show UnauthAgencyAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UnauthAgencyAct -> ShowS
showsPrec :: Int -> UnauthAgencyAct -> ShowS
$cshow :: UnauthAgencyAct -> String
show :: UnauthAgencyAct -> String
$cshowList :: [UnauthAgencyAct] -> ShowS
showList :: [UnauthAgencyAct] -> ShowS
Show)

-- | 점유권 추정 (민법 제197조, 제200조)
data PossessionAct = PossessionAct
  { PossessionAct -> PersonId
paActor  :: PersonId
  , PossessionAct -> ActId
paActId  :: ActId
  } deriving (PossessionAct -> PossessionAct -> Bool
(PossessionAct -> PossessionAct -> Bool)
-> (PossessionAct -> PossessionAct -> Bool) -> Eq PossessionAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PossessionAct -> PossessionAct -> Bool
== :: PossessionAct -> PossessionAct -> Bool
$c/= :: PossessionAct -> PossessionAct -> Bool
/= :: PossessionAct -> PossessionAct -> Bool
Eq, Int -> PossessionAct -> ShowS
[PossessionAct] -> ShowS
PossessionAct -> String
(Int -> PossessionAct -> ShowS)
-> (PossessionAct -> String)
-> ([PossessionAct] -> ShowS)
-> Show PossessionAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PossessionAct -> ShowS
showsPrec :: Int -> PossessionAct -> ShowS
$cshow :: PossessionAct -> String
show :: PossessionAct -> String
$cshowList :: [PossessionAct] -> ShowS
showList :: [PossessionAct] -> ShowS
Show)

-- | 소멸시효 (민법 제162조, 제168조, 제174조)
data PrescriptionAct = PrescriptionAct
  { PrescriptionAct -> PersonId
prCreditor :: PersonId
  , PrescriptionAct -> ActId
prClaimId  :: ActId
  } deriving (PrescriptionAct -> PrescriptionAct -> Bool
(PrescriptionAct -> PrescriptionAct -> Bool)
-> (PrescriptionAct -> PrescriptionAct -> Bool)
-> Eq PrescriptionAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrescriptionAct -> PrescriptionAct -> Bool
== :: PrescriptionAct -> PrescriptionAct -> Bool
$c/= :: PrescriptionAct -> PrescriptionAct -> Bool
/= :: PrescriptionAct -> PrescriptionAct -> Bool
Eq, Int -> PrescriptionAct -> ShowS
[PrescriptionAct] -> ShowS
PrescriptionAct -> String
(Int -> PrescriptionAct -> ShowS)
-> (PrescriptionAct -> String)
-> ([PrescriptionAct] -> ShowS)
-> Show PrescriptionAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrescriptionAct -> ShowS
showsPrec :: Int -> PrescriptionAct -> ShowS
$cshow :: PrescriptionAct -> String
show :: PrescriptionAct -> String
$cshowList :: [PrescriptionAct] -> ShowS
showList :: [PrescriptionAct] -> ShowS
Show)

-- | 소멸시효 판단에 필요한 시간적 사실관계
-- §157에 따라 역(曆)에 의한 계산: 기간을 연으로 정한 때에는
-- 기산일에 해당하는 날의 전일로 만료한다.
data PrescriptionFacts = PrescriptionFacts
  { PrescriptionFacts -> Day
pfClaimDate     :: Day        -- 채권 발생일
  , PrescriptionFacts -> Day
pfCurrentDate   :: Day        -- 판단 시점
  , PrescriptionFacts -> Int
pfPeriodYears   :: Int        -- 소멸시효기간 (년)
  , PrescriptionFacts -> Maybe Day
pfInterruptedOn :: Maybe Day  -- 중단 시점, Nothing = 중단 없음
  } deriving (PrescriptionFacts -> PrescriptionFacts -> Bool
(PrescriptionFacts -> PrescriptionFacts -> Bool)
-> (PrescriptionFacts -> PrescriptionFacts -> Bool)
-> Eq PrescriptionFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrescriptionFacts -> PrescriptionFacts -> Bool
== :: PrescriptionFacts -> PrescriptionFacts -> Bool
$c/= :: PrescriptionFacts -> PrescriptionFacts -> Bool
/= :: PrescriptionFacts -> PrescriptionFacts -> Bool
Eq, Int -> PrescriptionFacts -> ShowS
[PrescriptionFacts] -> ShowS
PrescriptionFacts -> String
(Int -> PrescriptionFacts -> ShowS)
-> (PrescriptionFacts -> String)
-> ([PrescriptionFacts] -> ShowS)
-> Show PrescriptionFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrescriptionFacts -> ShowS
showsPrec :: Int -> PrescriptionFacts -> ShowS
$cshow :: PrescriptionFacts -> String
show :: PrescriptionFacts -> String
$cshowList :: [PrescriptionFacts] -> ShowS
showList :: [PrescriptionFacts] -> ShowS
Show)

-- | 공유물의 처분 (민법 제264조)
data CoOwnershipAct = CoOwnershipAct
  { CoOwnershipAct -> ActId
coActId :: ActId
  } deriving (CoOwnershipAct -> CoOwnershipAct -> Bool
(CoOwnershipAct -> CoOwnershipAct -> Bool)
-> (CoOwnershipAct -> CoOwnershipAct -> Bool) -> Eq CoOwnershipAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CoOwnershipAct -> CoOwnershipAct -> Bool
== :: CoOwnershipAct -> CoOwnershipAct -> Bool
$c/= :: CoOwnershipAct -> CoOwnershipAct -> Bool
/= :: CoOwnershipAct -> CoOwnershipAct -> Bool
Eq, Int -> CoOwnershipAct -> ShowS
[CoOwnershipAct] -> ShowS
CoOwnershipAct -> String
(Int -> CoOwnershipAct -> ShowS)
-> (CoOwnershipAct -> String)
-> ([CoOwnershipAct] -> ShowS)
-> Show CoOwnershipAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CoOwnershipAct -> ShowS
showsPrec :: Int -> CoOwnershipAct -> ShowS
$cshow :: CoOwnershipAct -> String
show :: CoOwnershipAct -> String
$cshowList :: [CoOwnershipAct] -> ShowS
showList :: [CoOwnershipAct] -> ShowS
Show)

-- | 공유물 처분 판단에 필요한 사실관계
-- (demonstrates universal quantification: ∀ owner ∈ owners, owner ∈ consented)
data CoOwnershipFacts = CoOwnershipFacts
  { CoOwnershipFacts -> [PersonId]
cofOwners    :: [PersonId]       -- 공유자 전원
  , CoOwnershipFacts -> Set PersonId
cofConsented :: Set PersonId     -- 동의한 공유자
  } deriving (CoOwnershipFacts -> CoOwnershipFacts -> Bool
(CoOwnershipFacts -> CoOwnershipFacts -> Bool)
-> (CoOwnershipFacts -> CoOwnershipFacts -> Bool)
-> Eq CoOwnershipFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CoOwnershipFacts -> CoOwnershipFacts -> Bool
== :: CoOwnershipFacts -> CoOwnershipFacts -> Bool
$c/= :: CoOwnershipFacts -> CoOwnershipFacts -> Bool
/= :: CoOwnershipFacts -> CoOwnershipFacts -> Bool
Eq, Int -> CoOwnershipFacts -> ShowS
[CoOwnershipFacts] -> ShowS
CoOwnershipFacts -> String
(Int -> CoOwnershipFacts -> ShowS)
-> (CoOwnershipFacts -> String)
-> ([CoOwnershipFacts] -> ShowS)
-> Show CoOwnershipFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CoOwnershipFacts -> ShowS
showsPrec :: Int -> CoOwnershipFacts -> ShowS
$cshow :: CoOwnershipFacts -> String
show :: CoOwnershipFacts -> String
$cshowList :: [CoOwnershipFacts] -> ShowS
showList :: [CoOwnershipFacts] -> ShowS
Show)

-- | 불법행위 (민법 제750조, 제763조→제396조)
data TortAct = TortAct
  { TortAct -> PersonId
taVictim    :: PersonId
  , TortAct -> PersonId
taTortfeasor :: PersonId
  , TortAct -> ActId
taActId     :: ActId
  } deriving (TortAct -> TortAct -> Bool
(TortAct -> TortAct -> Bool)
-> (TortAct -> TortAct -> Bool) -> Eq TortAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TortAct -> TortAct -> Bool
== :: TortAct -> TortAct -> Bool
$c/= :: TortAct -> TortAct -> Bool
/= :: TortAct -> TortAct -> Bool
Eq, Int -> TortAct -> ShowS
[TortAct] -> ShowS
TortAct -> String
(Int -> TortAct -> ShowS)
-> (TortAct -> String) -> ([TortAct] -> ShowS) -> Show TortAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TortAct -> ShowS
showsPrec :: Int -> TortAct -> ShowS
$cshow :: TortAct -> String
show :: TortAct -> String
$cshowList :: [TortAct] -> ShowS
showList :: [TortAct] -> ShowS
Show)

-- | 불법행위 판단에 필요한 사실관계
data TortFacts = TortFacts
  { TortFacts -> Bool
tfFault     :: Bool   -- 고의 또는 과실
  , TortFacts -> Bool
tfUnlawful  :: Bool   -- 위법성
  , TortFacts -> Bool
tfDamage    :: Bool   -- 손해 발생
  , TortFacts -> Bool
tfCausation :: Bool   -- 인과관계
  , TortFacts -> Bool
tfVictimNeg :: Bool   -- 피해자의 과실 (과실상계 §763→§396)
  } deriving (TortFacts -> TortFacts -> Bool
(TortFacts -> TortFacts -> Bool)
-> (TortFacts -> TortFacts -> Bool) -> Eq TortFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TortFacts -> TortFacts -> Bool
== :: TortFacts -> TortFacts -> Bool
$c/= :: TortFacts -> TortFacts -> Bool
/= :: TortFacts -> TortFacts -> Bool
Eq, Int -> TortFacts -> ShowS
[TortFacts] -> ShowS
TortFacts -> String
(Int -> TortFacts -> ShowS)
-> (TortFacts -> String)
-> ([TortFacts] -> ShowS)
-> Show TortFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TortFacts -> ShowS
showsPrec :: Int -> TortFacts -> ShowS
$cshow :: TortFacts -> String
show :: TortFacts -> String
$cshowList :: [TortFacts] -> ShowS
showList :: [TortFacts] -> ShowS
Show)

-- Layer tokens for agency
data Ratification    -- 추인 (§130, §132)
data ApparentAuth    -- 표현대리 (§125-129)

-- Layer tokens for rebuttable presumptions
data Presumption     -- 추정 (default rule)
data Rebuttal        -- 반증 (rebuttal)

-- Layer tokens for prescription (소멸시효)
data Expiration      -- 시효만료 (§162)
data Interruption    -- 시효중단 (§168, §174)

-- Layer tokens for tort (불법행위)
data ContributoryNeg -- 과실상계 (§763→§396)

-- Layer tokens for property transfer (물권변동)
data FormException   -- §187 등기 없이 물권변동 (상속, 판결 등)

-- Layer tokens for acquisitive prescription (취득시효)
data ShortPrescription -- §245② 단기 취득시효 (10년, 선의·무과실)

-- Layer tokens for default obligation (채무불이행)
data CreditorDefense   -- §390 채권자 과실

-- Layer tokens for sale warranty (하자담보)
data BuyerKnowledge    -- §580② 매수인 악의·과실

-- Layer tokens for lease (임대차)
data RenewalRight      -- §639 묵시적 갱신

-- Layer tokens for agency remedies (무권대리 구제)
data CounterpartyKnowledge  -- §134 상대방의 악의

-- Layer tokens for partial invalidity (일부무효)
data HypotheticalIntent     -- §137 단서 가정적 의사
data Conversion             -- §138 무효행위의 전환

-- Layer tokens for cancellation (취소/추인)
data GeneralRatification       -- §143 추인
data ConstructiveRatification  -- §145 법정추인

-- Layer tokens for conditional acts (조건부 법률행위)
data IllegalCondition    -- §151 불법조건/기성조건
data BadFaithCondition   -- §150 반신의행위

-- | 취소의 제척기간 (민법 제146조)
data RescissionAct = RescissionAct
  { RescissionAct -> PersonId
raActor :: PersonId
  , RescissionAct -> ActId
raActId :: ActId
  } deriving (RescissionAct -> RescissionAct -> Bool
(RescissionAct -> RescissionAct -> Bool)
-> (RescissionAct -> RescissionAct -> Bool) -> Eq RescissionAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RescissionAct -> RescissionAct -> Bool
== :: RescissionAct -> RescissionAct -> Bool
$c/= :: RescissionAct -> RescissionAct -> Bool
/= :: RescissionAct -> RescissionAct -> Bool
Eq, Int -> RescissionAct -> ShowS
[RescissionAct] -> ShowS
RescissionAct -> String
(Int -> RescissionAct -> ShowS)
-> (RescissionAct -> String)
-> ([RescissionAct] -> ShowS)
-> Show RescissionAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RescissionAct -> ShowS
showsPrec :: Int -> RescissionAct -> ShowS
$cshow :: RescissionAct -> String
show :: RescissionAct -> String
$cshowList :: [RescissionAct] -> ShowS
showList :: [RescissionAct] -> ShowS
Show)

-- | 제척기간 판단에 필요한 시간적 사실관계
-- §157에 따라 역(曆)에 의한 계산.
data RescissionFacts = RescissionFacts
  { RescissionFacts -> Day
rfKnowledgeDate :: Day  -- 취소원인을 안 날
  , RescissionFacts -> Day
rfActDate       :: Day  -- 법률행위가 있은 날
  , RescissionFacts -> Day
rfCurrentDate   :: Day  -- 판단 시점
  } deriving (RescissionFacts -> RescissionFacts -> Bool
(RescissionFacts -> RescissionFacts -> Bool)
-> (RescissionFacts -> RescissionFacts -> Bool)
-> Eq RescissionFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RescissionFacts -> RescissionFacts -> Bool
== :: RescissionFacts -> RescissionFacts -> Bool
$c/= :: RescissionFacts -> RescissionFacts -> Bool
/= :: RescissionFacts -> RescissionFacts -> Bool
Eq, Int -> RescissionFacts -> ShowS
[RescissionFacts] -> ShowS
RescissionFacts -> String
(Int -> RescissionFacts -> ShowS)
-> (RescissionFacts -> String)
-> ([RescissionFacts] -> ShowS)
-> Show RescissionFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RescissionFacts -> ShowS
showsPrec :: Int -> RescissionFacts -> ShowS
$cshow :: RescissionFacts -> String
show :: RescissionFacts -> String
$cshowList :: [RescissionFacts] -> ShowS
showList :: [RescissionFacts] -> ShowS
Show)

-- | 물권변동 (민법 제186조, 제187조, 제188조)
data PropertyTransferAct = PropertyTransferAct
  { PropertyTransferAct -> PersonId
ptActor :: PersonId
  , PropertyTransferAct -> ActId
ptActId :: ActId
  } deriving (PropertyTransferAct -> PropertyTransferAct -> Bool
(PropertyTransferAct -> PropertyTransferAct -> Bool)
-> (PropertyTransferAct -> PropertyTransferAct -> Bool)
-> Eq PropertyTransferAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PropertyTransferAct -> PropertyTransferAct -> Bool
== :: PropertyTransferAct -> PropertyTransferAct -> Bool
$c/= :: PropertyTransferAct -> PropertyTransferAct -> Bool
/= :: PropertyTransferAct -> PropertyTransferAct -> Bool
Eq, Int -> PropertyTransferAct -> ShowS
[PropertyTransferAct] -> ShowS
PropertyTransferAct -> String
(Int -> PropertyTransferAct -> ShowS)
-> (PropertyTransferAct -> String)
-> ([PropertyTransferAct] -> ShowS)
-> Show PropertyTransferAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PropertyTransferAct -> ShowS
showsPrec :: Int -> PropertyTransferAct -> ShowS
$cshow :: PropertyTransferAct -> String
show :: PropertyTransferAct -> String
$cshowList :: [PropertyTransferAct] -> ShowS
showList :: [PropertyTransferAct] -> ShowS
Show)

-- | 취득시효 (민법 제245조, 제246조)
data AcqPrescriptionAct = AcqPrescriptionAct
  { AcqPrescriptionAct -> PersonId
apActor :: PersonId
  , AcqPrescriptionAct -> ActId
apActId :: ActId
  } deriving (AcqPrescriptionAct -> AcqPrescriptionAct -> Bool
(AcqPrescriptionAct -> AcqPrescriptionAct -> Bool)
-> (AcqPrescriptionAct -> AcqPrescriptionAct -> Bool)
-> Eq AcqPrescriptionAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AcqPrescriptionAct -> AcqPrescriptionAct -> Bool
== :: AcqPrescriptionAct -> AcqPrescriptionAct -> Bool
$c/= :: AcqPrescriptionAct -> AcqPrescriptionAct -> Bool
/= :: AcqPrescriptionAct -> AcqPrescriptionAct -> Bool
Eq, Int -> AcqPrescriptionAct -> ShowS
[AcqPrescriptionAct] -> ShowS
AcqPrescriptionAct -> String
(Int -> AcqPrescriptionAct -> ShowS)
-> (AcqPrescriptionAct -> String)
-> ([AcqPrescriptionAct] -> ShowS)
-> Show AcqPrescriptionAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AcqPrescriptionAct -> ShowS
showsPrec :: Int -> AcqPrescriptionAct -> ShowS
$cshow :: AcqPrescriptionAct -> String
show :: AcqPrescriptionAct -> String
$cshowList :: [AcqPrescriptionAct] -> ShowS
showList :: [AcqPrescriptionAct] -> ShowS
Show)

-- | 취득시효 판단에 필요한 사실관계
-- §157에 따라 역(曆)에 의한 계산.
data AcqPrescFacts = AcqPrescFacts
  { AcqPrescFacts -> Day
apfStartDate       :: Day   -- 점유 개시일
  , AcqPrescFacts -> Day
apfCurrentDate     :: Day   -- 판단 시점
  , AcqPrescFacts -> Bool
apfGoodFaith       :: Bool  -- 선의
  , AcqPrescFacts -> Bool
apfNoNegligence    :: Bool  -- 무과실
  , AcqPrescFacts -> Bool
apfPeaceful        :: Bool  -- 평온
  , AcqPrescFacts -> Bool
apfPublic          :: Bool  -- 공연
  , AcqPrescFacts -> Bool
apfSelfPossession  :: Bool  -- 자주점유 (소유의 의사)
  } deriving (AcqPrescFacts -> AcqPrescFacts -> Bool
(AcqPrescFacts -> AcqPrescFacts -> Bool)
-> (AcqPrescFacts -> AcqPrescFacts -> Bool) -> Eq AcqPrescFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AcqPrescFacts -> AcqPrescFacts -> Bool
== :: AcqPrescFacts -> AcqPrescFacts -> Bool
$c/= :: AcqPrescFacts -> AcqPrescFacts -> Bool
/= :: AcqPrescFacts -> AcqPrescFacts -> Bool
Eq, Int -> AcqPrescFacts -> ShowS
[AcqPrescFacts] -> ShowS
AcqPrescFacts -> String
(Int -> AcqPrescFacts -> ShowS)
-> (AcqPrescFacts -> String)
-> ([AcqPrescFacts] -> ShowS)
-> Show AcqPrescFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AcqPrescFacts -> ShowS
showsPrec :: Int -> AcqPrescFacts -> ShowS
$cshow :: AcqPrescFacts -> String
show :: AcqPrescFacts -> String
$cshowList :: [AcqPrescFacts] -> ShowS
showList :: [AcqPrescFacts] -> ShowS
Show)

-- | 채무불이행 (민법 제387조-제390조)
data DefaultAct = DefaultAct
  { DefaultAct -> PersonId
dfCreditor :: PersonId
  , DefaultAct -> PersonId
dfDebtor   :: PersonId
  , DefaultAct -> ActId
dfActId    :: ActId
  } deriving (DefaultAct -> DefaultAct -> Bool
(DefaultAct -> DefaultAct -> Bool)
-> (DefaultAct -> DefaultAct -> Bool) -> Eq DefaultAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DefaultAct -> DefaultAct -> Bool
== :: DefaultAct -> DefaultAct -> Bool
$c/= :: DefaultAct -> DefaultAct -> Bool
/= :: DefaultAct -> DefaultAct -> Bool
Eq, Int -> DefaultAct -> ShowS
[DefaultAct] -> ShowS
DefaultAct -> String
(Int -> DefaultAct -> ShowS)
-> (DefaultAct -> String)
-> ([DefaultAct] -> ShowS)
-> Show DefaultAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DefaultAct -> ShowS
showsPrec :: Int -> DefaultAct -> ShowS
$cshow :: DefaultAct -> String
show :: DefaultAct -> String
$cshowList :: [DefaultAct] -> ShowS
showList :: [DefaultAct] -> ShowS
Show)

-- | 채무불이행 판단에 필요한 사실관계
data DefaultFacts = DefaultFacts
  { DefaultFacts -> Bool
dfPerformanceDue :: Bool  -- 이행기 도래
  , DefaultFacts -> Bool
dfNonPerformance :: Bool  -- 불이행
  , DefaultFacts -> Bool
dfDebtorFault    :: Bool  -- 채무자 귀책사유
  , DefaultFacts -> Bool
dfImpossible     :: Bool  -- 이행불능
  , DefaultFacts -> Bool
dfCreditorFault  :: Bool  -- 채권자 과실 (§390)
  } deriving (DefaultFacts -> DefaultFacts -> Bool
(DefaultFacts -> DefaultFacts -> Bool)
-> (DefaultFacts -> DefaultFacts -> Bool) -> Eq DefaultFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DefaultFacts -> DefaultFacts -> Bool
== :: DefaultFacts -> DefaultFacts -> Bool
$c/= :: DefaultFacts -> DefaultFacts -> Bool
/= :: DefaultFacts -> DefaultFacts -> Bool
Eq, Int -> DefaultFacts -> ShowS
[DefaultFacts] -> ShowS
DefaultFacts -> String
(Int -> DefaultFacts -> ShowS)
-> (DefaultFacts -> String)
-> ([DefaultFacts] -> ShowS)
-> Show DefaultFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DefaultFacts -> ShowS
showsPrec :: Int -> DefaultFacts -> ShowS
$cshow :: DefaultFacts -> String
show :: DefaultFacts -> String
$cshowList :: [DefaultFacts] -> ShowS
showList :: [DefaultFacts] -> ShowS
Show)

-- | 하자담보책임 (민법 제580조-제582조)
data WarrantyAct = WarrantyAct
  { WarrantyAct -> PersonId
waActor :: PersonId
  , WarrantyAct -> ActId
waActId :: ActId
  } deriving (WarrantyAct -> WarrantyAct -> Bool
(WarrantyAct -> WarrantyAct -> Bool)
-> (WarrantyAct -> WarrantyAct -> Bool) -> Eq WarrantyAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WarrantyAct -> WarrantyAct -> Bool
== :: WarrantyAct -> WarrantyAct -> Bool
$c/= :: WarrantyAct -> WarrantyAct -> Bool
/= :: WarrantyAct -> WarrantyAct -> Bool
Eq, Int -> WarrantyAct -> ShowS
[WarrantyAct] -> ShowS
WarrantyAct -> String
(Int -> WarrantyAct -> ShowS)
-> (WarrantyAct -> String)
-> ([WarrantyAct] -> ShowS)
-> Show WarrantyAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WarrantyAct -> ShowS
showsPrec :: Int -> WarrantyAct -> ShowS
$cshow :: WarrantyAct -> String
show :: WarrantyAct -> String
$cshowList :: [WarrantyAct] -> ShowS
showList :: [WarrantyAct] -> ShowS
Show)

-- | 하자담보 판단에 필요한 사실관계
data WarrantyFacts = WarrantyFacts
  { WarrantyFacts -> Bool
wfDefectExists   :: Bool  -- 하자 존재
  , WarrantyFacts -> Bool
wfSignificant    :: Bool  -- 중대한 하자 (계약목적 달성 불가)
  , WarrantyFacts -> Bool
wfBuyerKnew      :: Bool  -- 매수인이 알았거나 과실로 몰랐음
  , WarrantyFacts -> Bool
wfNotifiedInTime :: Bool  -- 6개월 내 통지 (§582)
  } deriving (WarrantyFacts -> WarrantyFacts -> Bool
(WarrantyFacts -> WarrantyFacts -> Bool)
-> (WarrantyFacts -> WarrantyFacts -> Bool) -> Eq WarrantyFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WarrantyFacts -> WarrantyFacts -> Bool
== :: WarrantyFacts -> WarrantyFacts -> Bool
$c/= :: WarrantyFacts -> WarrantyFacts -> Bool
/= :: WarrantyFacts -> WarrantyFacts -> Bool
Eq, Int -> WarrantyFacts -> ShowS
[WarrantyFacts] -> ShowS
WarrantyFacts -> String
(Int -> WarrantyFacts -> ShowS)
-> (WarrantyFacts -> String)
-> ([WarrantyFacts] -> ShowS)
-> Show WarrantyFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WarrantyFacts -> ShowS
showsPrec :: Int -> WarrantyFacts -> ShowS
$cshow :: WarrantyFacts -> String
show :: WarrantyFacts -> String
$cshowList :: [WarrantyFacts] -> ShowS
showList :: [WarrantyFacts] -> ShowS
Show)

-- | 임대차 (민법 제618조, 제623조, 제639조, 제640조)
data LeaseAct = LeaseAct
  { LeaseAct -> PersonId
laLessor :: PersonId
  , LeaseAct -> PersonId
laLessee :: PersonId
  , LeaseAct -> ActId
laActId  :: ActId
  } deriving (LeaseAct -> LeaseAct -> Bool
(LeaseAct -> LeaseAct -> Bool)
-> (LeaseAct -> LeaseAct -> Bool) -> Eq LeaseAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LeaseAct -> LeaseAct -> Bool
== :: LeaseAct -> LeaseAct -> Bool
$c/= :: LeaseAct -> LeaseAct -> Bool
/= :: LeaseAct -> LeaseAct -> Bool
Eq, Int -> LeaseAct -> ShowS
[LeaseAct] -> ShowS
LeaseAct -> String
(Int -> LeaseAct -> ShowS)
-> (LeaseAct -> String) -> ([LeaseAct] -> ShowS) -> Show LeaseAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LeaseAct -> ShowS
showsPrec :: Int -> LeaseAct -> ShowS
$cshow :: LeaseAct -> String
show :: LeaseAct -> String
$cshowList :: [LeaseAct] -> ShowS
showList :: [LeaseAct] -> ShowS
Show)

-- | 임대차 판단에 필요한 사실관계
data LeaseFacts = LeaseFacts
  { LeaseFacts -> Bool
lfValidContract  :: Bool  -- 유효한 임대차계약
  , LeaseFacts -> Bool
lfRentPaid       :: Bool  -- 차임 지급
  , LeaseFacts -> Bool
lfPeriodExpired  :: Bool  -- 기간 만료
  , LeaseFacts -> Bool
lfContinuedUse   :: Bool  -- 기간 만료 후 계속 사용
  , LeaseFacts -> Bool
lfNoObjection    :: Bool  -- 임대인 이의 없음
  , LeaseFacts -> Bool
lfTwoRentsLate   :: Bool  -- 2기의 차임 연체 (§640)
  } deriving (LeaseFacts -> LeaseFacts -> Bool
(LeaseFacts -> LeaseFacts -> Bool)
-> (LeaseFacts -> LeaseFacts -> Bool) -> Eq LeaseFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LeaseFacts -> LeaseFacts -> Bool
== :: LeaseFacts -> LeaseFacts -> Bool
$c/= :: LeaseFacts -> LeaseFacts -> Bool
/= :: LeaseFacts -> LeaseFacts -> Bool
Eq, Int -> LeaseFacts -> ShowS
[LeaseFacts] -> ShowS
LeaseFacts -> String
(Int -> LeaseFacts -> ShowS)
-> (LeaseFacts -> String)
-> ([LeaseFacts] -> ShowS)
-> Show LeaseFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LeaseFacts -> ShowS
showsPrec :: Int -> LeaseFacts -> ShowS
$cshow :: LeaseFacts -> String
show :: LeaseFacts -> String
$cshowList :: [LeaseFacts] -> ShowS
showList :: [LeaseFacts] -> ShowS
Show)

-- | 상대방의 철회권 (민법 제134조)
data AgencyWithdrawalAct = AgencyWithdrawalAct
  { AgencyWithdrawalAct -> PersonId
awPrincipal    :: PersonId
  , AgencyWithdrawalAct -> PersonId
awCounterparty :: PersonId
  , AgencyWithdrawalAct -> ActId
awActId        :: ActId
  } deriving (AgencyWithdrawalAct -> AgencyWithdrawalAct -> Bool
(AgencyWithdrawalAct -> AgencyWithdrawalAct -> Bool)
-> (AgencyWithdrawalAct -> AgencyWithdrawalAct -> Bool)
-> Eq AgencyWithdrawalAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AgencyWithdrawalAct -> AgencyWithdrawalAct -> Bool
== :: AgencyWithdrawalAct -> AgencyWithdrawalAct -> Bool
$c/= :: AgencyWithdrawalAct -> AgencyWithdrawalAct -> Bool
/= :: AgencyWithdrawalAct -> AgencyWithdrawalAct -> Bool
Eq, Int -> AgencyWithdrawalAct -> ShowS
[AgencyWithdrawalAct] -> ShowS
AgencyWithdrawalAct -> String
(Int -> AgencyWithdrawalAct -> ShowS)
-> (AgencyWithdrawalAct -> String)
-> ([AgencyWithdrawalAct] -> ShowS)
-> Show AgencyWithdrawalAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AgencyWithdrawalAct -> ShowS
showsPrec :: Int -> AgencyWithdrawalAct -> ShowS
$cshow :: AgencyWithdrawalAct -> String
show :: AgencyWithdrawalAct -> String
$cshowList :: [AgencyWithdrawalAct] -> ShowS
showList :: [AgencyWithdrawalAct] -> ShowS
Show)

-- | 무권대리인의 책임 (민법 제135조)
data AgentLiabilityAct = AgentLiabilityAct
  { AgentLiabilityAct -> PersonId
alAgent        :: PersonId
  , AgentLiabilityAct -> PersonId
alCounterparty :: PersonId
  , AgentLiabilityAct -> ActId
alActId        :: ActId
  } deriving (AgentLiabilityAct -> AgentLiabilityAct -> Bool
(AgentLiabilityAct -> AgentLiabilityAct -> Bool)
-> (AgentLiabilityAct -> AgentLiabilityAct -> Bool)
-> Eq AgentLiabilityAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AgentLiabilityAct -> AgentLiabilityAct -> Bool
== :: AgentLiabilityAct -> AgentLiabilityAct -> Bool
$c/= :: AgentLiabilityAct -> AgentLiabilityAct -> Bool
/= :: AgentLiabilityAct -> AgentLiabilityAct -> Bool
Eq, Int -> AgentLiabilityAct -> ShowS
[AgentLiabilityAct] -> ShowS
AgentLiabilityAct -> String
(Int -> AgentLiabilityAct -> ShowS)
-> (AgentLiabilityAct -> String)
-> ([AgentLiabilityAct] -> ShowS)
-> Show AgentLiabilityAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AgentLiabilityAct -> ShowS
showsPrec :: Int -> AgentLiabilityAct -> ShowS
$cshow :: AgentLiabilityAct -> String
show :: AgentLiabilityAct -> String
$cshowList :: [AgentLiabilityAct] -> ShowS
showList :: [AgentLiabilityAct] -> ShowS
Show)

-- | 법률행위의 일부무효/전환/추인 (민법 제137조-제139조)
data PartialInvalidityAct = PartialInvalidityAct
  { PartialInvalidityAct -> ActId
piActId :: ActId
  } deriving (PartialInvalidityAct -> PartialInvalidityAct -> Bool
(PartialInvalidityAct -> PartialInvalidityAct -> Bool)
-> (PartialInvalidityAct -> PartialInvalidityAct -> Bool)
-> Eq PartialInvalidityAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PartialInvalidityAct -> PartialInvalidityAct -> Bool
== :: PartialInvalidityAct -> PartialInvalidityAct -> Bool
$c/= :: PartialInvalidityAct -> PartialInvalidityAct -> Bool
/= :: PartialInvalidityAct -> PartialInvalidityAct -> Bool
Eq, Int -> PartialInvalidityAct -> ShowS
[PartialInvalidityAct] -> ShowS
PartialInvalidityAct -> String
(Int -> PartialInvalidityAct -> ShowS)
-> (PartialInvalidityAct -> String)
-> ([PartialInvalidityAct] -> ShowS)
-> Show PartialInvalidityAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PartialInvalidityAct -> ShowS
showsPrec :: Int -> PartialInvalidityAct -> ShowS
$cshow :: PartialInvalidityAct -> String
show :: PartialInvalidityAct -> String
$cshowList :: [PartialInvalidityAct] -> ShowS
showList :: [PartialInvalidityAct] -> ShowS
Show)

-- | 일부무효 판단에 필요한 사실관계
data PartialInvalidityFacts = PartialInvalidityFacts
  { PartialInvalidityFacts -> Bool
pifPartVoid              :: Bool  -- 일부분이 무효
  , PartialInvalidityFacts -> Bool
pifHypotheticalIntent    :: Bool  -- 무효부분 없이도 행위했을 것 (§137 단서)
  , PartialInvalidityFacts -> Bool
pifMeetsOtherReqs        :: Bool  -- 다른 법률행위 요건 구비 (§138)
  , PartialInvalidityFacts -> Bool
pifConversionIntent      :: Bool  -- 다른 행위를 의욕 (§138)
  , PartialInvalidityFacts -> Bool
pifRatifiedWithKnowledge :: Bool  -- 무효 알고 추인 (§139)
  } deriving (PartialInvalidityFacts -> PartialInvalidityFacts -> Bool
(PartialInvalidityFacts -> PartialInvalidityFacts -> Bool)
-> (PartialInvalidityFacts -> PartialInvalidityFacts -> Bool)
-> Eq PartialInvalidityFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PartialInvalidityFacts -> PartialInvalidityFacts -> Bool
== :: PartialInvalidityFacts -> PartialInvalidityFacts -> Bool
$c/= :: PartialInvalidityFacts -> PartialInvalidityFacts -> Bool
/= :: PartialInvalidityFacts -> PartialInvalidityFacts -> Bool
Eq, Int -> PartialInvalidityFacts -> ShowS
[PartialInvalidityFacts] -> ShowS
PartialInvalidityFacts -> String
(Int -> PartialInvalidityFacts -> ShowS)
-> (PartialInvalidityFacts -> String)
-> ([PartialInvalidityFacts] -> ShowS)
-> Show PartialInvalidityFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PartialInvalidityFacts -> ShowS
showsPrec :: Int -> PartialInvalidityFacts -> ShowS
$cshow :: PartialInvalidityFacts -> String
show :: PartialInvalidityFacts -> String
$cshowList :: [PartialInvalidityFacts] -> ShowS
showList :: [PartialInvalidityFacts] -> ShowS
Show)

-- | 취소할 수 있는 행위의 취소/추인 (민법 제141조, 제143조-제145조)
-- 다른 act type의 query 결과(Verdict)를 입력으로 받는 wrapper pattern.
data CancellableAct = CancellableAct
  { CancellableAct -> ActId
caActId        :: ActId
  , CancellableAct -> Verdict
caPriorVerdict :: Verdict
  } deriving (CancellableAct -> CancellableAct -> Bool
(CancellableAct -> CancellableAct -> Bool)
-> (CancellableAct -> CancellableAct -> Bool) -> Eq CancellableAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CancellableAct -> CancellableAct -> Bool
== :: CancellableAct -> CancellableAct -> Bool
$c/= :: CancellableAct -> CancellableAct -> Bool
/= :: CancellableAct -> CancellableAct -> Bool
Eq, Int -> CancellableAct -> ShowS
[CancellableAct] -> ShowS
CancellableAct -> String
(Int -> CancellableAct -> ShowS)
-> (CancellableAct -> String)
-> ([CancellableAct] -> ShowS)
-> Show CancellableAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CancellableAct -> ShowS
showsPrec :: Int -> CancellableAct -> ShowS
$cshow :: CancellableAct -> String
show :: CancellableAct -> String
$cshowList :: [CancellableAct] -> ShowS
showList :: [CancellableAct] -> ShowS
Show)

-- | 취소/추인 판단에 필요한 사실관계
data CancellationFacts = CancellationFacts
  { CancellationFacts -> Bool
cnfCancelled          :: Bool
  , CancellationFacts -> Bool
cnfRatified           :: Bool
  , CancellationFacts -> Bool
cnfCauseCeased        :: Bool
  , CancellationFacts -> Bool
cnfRatifierIsGuardian :: Bool
  , CancellationFacts -> Maybe ConstructiveRatificationEvent
cnfConstructive       :: Maybe ConstructiveRatificationEvent
  , CancellationFacts -> Bool
cnfObjectionReserved  :: Bool
  } deriving (CancellationFacts -> CancellationFacts -> Bool
(CancellationFacts -> CancellationFacts -> Bool)
-> (CancellationFacts -> CancellationFacts -> Bool)
-> Eq CancellationFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CancellationFacts -> CancellationFacts -> Bool
== :: CancellationFacts -> CancellationFacts -> Bool
$c/= :: CancellationFacts -> CancellationFacts -> Bool
/= :: CancellationFacts -> CancellationFacts -> Bool
Eq, Int -> CancellationFacts -> ShowS
[CancellationFacts] -> ShowS
CancellationFacts -> String
(Int -> CancellationFacts -> ShowS)
-> (CancellationFacts -> String)
-> ([CancellationFacts] -> ShowS)
-> Show CancellationFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CancellationFacts -> ShowS
showsPrec :: Int -> CancellationFacts -> ShowS
$cshow :: CancellationFacts -> String
show :: CancellationFacts -> String
$cshowList :: [CancellationFacts] -> ShowS
showList :: [CancellationFacts] -> ShowS
Show)

-- | 법정추인 사유 (민법 제145조)
data ConstructiveRatificationEvent
  = FullOrPartialPerformance
  | DemandForPerformance
  | Novation
  | SecurityProvision
  | RightAssignment
  | CompulsoryExecution
  deriving (ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
(ConstructiveRatificationEvent
 -> ConstructiveRatificationEvent -> Bool)
-> (ConstructiveRatificationEvent
    -> ConstructiveRatificationEvent -> Bool)
-> Eq ConstructiveRatificationEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
== :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
$c/= :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
/= :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
Eq, Eq ConstructiveRatificationEvent
Eq ConstructiveRatificationEvent =>
(ConstructiveRatificationEvent
 -> ConstructiveRatificationEvent -> Ordering)
-> (ConstructiveRatificationEvent
    -> ConstructiveRatificationEvent -> Bool)
-> (ConstructiveRatificationEvent
    -> ConstructiveRatificationEvent -> Bool)
-> (ConstructiveRatificationEvent
    -> ConstructiveRatificationEvent -> Bool)
-> (ConstructiveRatificationEvent
    -> ConstructiveRatificationEvent -> Bool)
-> (ConstructiveRatificationEvent
    -> ConstructiveRatificationEvent -> ConstructiveRatificationEvent)
-> (ConstructiveRatificationEvent
    -> ConstructiveRatificationEvent -> ConstructiveRatificationEvent)
-> Ord ConstructiveRatificationEvent
ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Ordering
ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> ConstructiveRatificationEvent
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 :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Ordering
compare :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Ordering
$c< :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
< :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
$c<= :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
<= :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
$c> :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
> :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
$c>= :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
>= :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> Bool
$cmax :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> ConstructiveRatificationEvent
max :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> ConstructiveRatificationEvent
$cmin :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> ConstructiveRatificationEvent
min :: ConstructiveRatificationEvent
-> ConstructiveRatificationEvent -> ConstructiveRatificationEvent
Ord, Int -> ConstructiveRatificationEvent -> ShowS
[ConstructiveRatificationEvent] -> ShowS
ConstructiveRatificationEvent -> String
(Int -> ConstructiveRatificationEvent -> ShowS)
-> (ConstructiveRatificationEvent -> String)
-> ([ConstructiveRatificationEvent] -> ShowS)
-> Show ConstructiveRatificationEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConstructiveRatificationEvent -> ShowS
showsPrec :: Int -> ConstructiveRatificationEvent -> ShowS
$cshow :: ConstructiveRatificationEvent -> String
show :: ConstructiveRatificationEvent -> String
$cshowList :: [ConstructiveRatificationEvent] -> ShowS
showList :: [ConstructiveRatificationEvent] -> ShowS
Show)

-- | 조건부/기한부 법률행위 (민법 제147조, 제150조-제152조)
data ConditionalAct = ConditionalAct
  { ConditionalAct -> ActId
condActId :: ActId
  } deriving (ConditionalAct -> ConditionalAct -> Bool
(ConditionalAct -> ConditionalAct -> Bool)
-> (ConditionalAct -> ConditionalAct -> Bool) -> Eq ConditionalAct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConditionalAct -> ConditionalAct -> Bool
== :: ConditionalAct -> ConditionalAct -> Bool
$c/= :: ConditionalAct -> ConditionalAct -> Bool
/= :: ConditionalAct -> ConditionalAct -> Bool
Eq, Int -> ConditionalAct -> ShowS
[ConditionalAct] -> ShowS
ConditionalAct -> String
(Int -> ConditionalAct -> ShowS)
-> (ConditionalAct -> String)
-> ([ConditionalAct] -> ShowS)
-> Show ConditionalAct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConditionalAct -> ShowS
showsPrec :: Int -> ConditionalAct -> ShowS
$cshow :: ConditionalAct -> String
show :: ConditionalAct -> String
$cshowList :: [ConditionalAct] -> ShowS
showList :: [ConditionalAct] -> ShowS
Show)

-- | 조건의 유형
data ConditionType
  = Suspensive  -- 정지조건 (§147①)
  | Resolutive  -- 해제조건 (§147②)
  | StartDate   -- 시기 (§152①)
  | EndDate     -- 종기 (§152②)
  deriving (ConditionType -> ConditionType -> Bool
(ConditionType -> ConditionType -> Bool)
-> (ConditionType -> ConditionType -> Bool) -> Eq ConditionType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConditionType -> ConditionType -> Bool
== :: ConditionType -> ConditionType -> Bool
$c/= :: ConditionType -> ConditionType -> Bool
/= :: ConditionType -> ConditionType -> Bool
Eq, Eq ConditionType
Eq ConditionType =>
(ConditionType -> ConditionType -> Ordering)
-> (ConditionType -> ConditionType -> Bool)
-> (ConditionType -> ConditionType -> Bool)
-> (ConditionType -> ConditionType -> Bool)
-> (ConditionType -> ConditionType -> Bool)
-> (ConditionType -> ConditionType -> ConditionType)
-> (ConditionType -> ConditionType -> ConditionType)
-> Ord ConditionType
ConditionType -> ConditionType -> Bool
ConditionType -> ConditionType -> Ordering
ConditionType -> ConditionType -> ConditionType
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 :: ConditionType -> ConditionType -> Ordering
compare :: ConditionType -> ConditionType -> Ordering
$c< :: ConditionType -> ConditionType -> Bool
< :: ConditionType -> ConditionType -> Bool
$c<= :: ConditionType -> ConditionType -> Bool
<= :: ConditionType -> ConditionType -> Bool
$c> :: ConditionType -> ConditionType -> Bool
> :: ConditionType -> ConditionType -> Bool
$c>= :: ConditionType -> ConditionType -> Bool
>= :: ConditionType -> ConditionType -> Bool
$cmax :: ConditionType -> ConditionType -> ConditionType
max :: ConditionType -> ConditionType -> ConditionType
$cmin :: ConditionType -> ConditionType -> ConditionType
min :: ConditionType -> ConditionType -> ConditionType
Ord, Int -> ConditionType -> ShowS
[ConditionType] -> ShowS
ConditionType -> String
(Int -> ConditionType -> ShowS)
-> (ConditionType -> String)
-> ([ConditionType] -> ShowS)
-> Show ConditionType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConditionType -> ShowS
showsPrec :: Int -> ConditionType -> ShowS
$cshow :: ConditionType -> String
show :: ConditionType -> String
$cshowList :: [ConditionType] -> ShowS
showList :: [ConditionType] -> ShowS
Show)

-- | 조건의 상태
data ConditionState
  = CondPending     -- 미성취
  | CondFulfilled   -- 성취
  | CondImpossible  -- 성취 불가능
  | CondIllegal     -- 불법조건
  deriving (ConditionState -> ConditionState -> Bool
(ConditionState -> ConditionState -> Bool)
-> (ConditionState -> ConditionState -> Bool) -> Eq ConditionState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConditionState -> ConditionState -> Bool
== :: ConditionState -> ConditionState -> Bool
$c/= :: ConditionState -> ConditionState -> Bool
/= :: ConditionState -> ConditionState -> Bool
Eq, Eq ConditionState
Eq ConditionState =>
(ConditionState -> ConditionState -> Ordering)
-> (ConditionState -> ConditionState -> Bool)
-> (ConditionState -> ConditionState -> Bool)
-> (ConditionState -> ConditionState -> Bool)
-> (ConditionState -> ConditionState -> Bool)
-> (ConditionState -> ConditionState -> ConditionState)
-> (ConditionState -> ConditionState -> ConditionState)
-> Ord ConditionState
ConditionState -> ConditionState -> Bool
ConditionState -> ConditionState -> Ordering
ConditionState -> ConditionState -> ConditionState
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 :: ConditionState -> ConditionState -> Ordering
compare :: ConditionState -> ConditionState -> Ordering
$c< :: ConditionState -> ConditionState -> Bool
< :: ConditionState -> ConditionState -> Bool
$c<= :: ConditionState -> ConditionState -> Bool
<= :: ConditionState -> ConditionState -> Bool
$c> :: ConditionState -> ConditionState -> Bool
> :: ConditionState -> ConditionState -> Bool
$c>= :: ConditionState -> ConditionState -> Bool
>= :: ConditionState -> ConditionState -> Bool
$cmax :: ConditionState -> ConditionState -> ConditionState
max :: ConditionState -> ConditionState -> ConditionState
$cmin :: ConditionState -> ConditionState -> ConditionState
min :: ConditionState -> ConditionState -> ConditionState
Ord, Int -> ConditionState -> ShowS
[ConditionState] -> ShowS
ConditionState -> String
(Int -> ConditionState -> ShowS)
-> (ConditionState -> String)
-> ([ConditionState] -> ShowS)
-> Show ConditionState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConditionState -> ShowS
showsPrec :: Int -> ConditionState -> ShowS
$cshow :: ConditionState -> String
show :: ConditionState -> String
$cshowList :: [ConditionState] -> ShowS
showList :: [ConditionState] -> ShowS
Show)

-- | 반신의행위의 유형 (민법 제150조)
data BadFaithKind
  = BadFaithPrevention  -- 조건 성취 방해 (§150①)
  | BadFaithCausation   -- 조건 성취 야기 (§150②)
  deriving (BadFaithKind -> BadFaithKind -> Bool
(BadFaithKind -> BadFaithKind -> Bool)
-> (BadFaithKind -> BadFaithKind -> Bool) -> Eq BadFaithKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BadFaithKind -> BadFaithKind -> Bool
== :: BadFaithKind -> BadFaithKind -> Bool
$c/= :: BadFaithKind -> BadFaithKind -> Bool
/= :: BadFaithKind -> BadFaithKind -> Bool
Eq, Eq BadFaithKind
Eq BadFaithKind =>
(BadFaithKind -> BadFaithKind -> Ordering)
-> (BadFaithKind -> BadFaithKind -> Bool)
-> (BadFaithKind -> BadFaithKind -> Bool)
-> (BadFaithKind -> BadFaithKind -> Bool)
-> (BadFaithKind -> BadFaithKind -> Bool)
-> (BadFaithKind -> BadFaithKind -> BadFaithKind)
-> (BadFaithKind -> BadFaithKind -> BadFaithKind)
-> Ord BadFaithKind
BadFaithKind -> BadFaithKind -> Bool
BadFaithKind -> BadFaithKind -> Ordering
BadFaithKind -> BadFaithKind -> BadFaithKind
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 :: BadFaithKind -> BadFaithKind -> Ordering
compare :: BadFaithKind -> BadFaithKind -> Ordering
$c< :: BadFaithKind -> BadFaithKind -> Bool
< :: BadFaithKind -> BadFaithKind -> Bool
$c<= :: BadFaithKind -> BadFaithKind -> Bool
<= :: BadFaithKind -> BadFaithKind -> Bool
$c> :: BadFaithKind -> BadFaithKind -> Bool
> :: BadFaithKind -> BadFaithKind -> Bool
$c>= :: BadFaithKind -> BadFaithKind -> Bool
>= :: BadFaithKind -> BadFaithKind -> Bool
$cmax :: BadFaithKind -> BadFaithKind -> BadFaithKind
max :: BadFaithKind -> BadFaithKind -> BadFaithKind
$cmin :: BadFaithKind -> BadFaithKind -> BadFaithKind
min :: BadFaithKind -> BadFaithKind -> BadFaithKind
Ord, Int -> BadFaithKind -> ShowS
[BadFaithKind] -> ShowS
BadFaithKind -> String
(Int -> BadFaithKind -> ShowS)
-> (BadFaithKind -> String)
-> ([BadFaithKind] -> ShowS)
-> Show BadFaithKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BadFaithKind -> ShowS
showsPrec :: Int -> BadFaithKind -> ShowS
$cshow :: BadFaithKind -> String
show :: BadFaithKind -> String
$cshowList :: [BadFaithKind] -> ShowS
showList :: [BadFaithKind] -> ShowS
Show)

-- | 조건부 법률행위 판단에 필요한 사실관계
data ConditionalFacts = ConditionalFacts
  { ConditionalFacts -> ConditionType
condType     :: ConditionType
  , ConditionalFacts -> ConditionState
condState    :: ConditionState
  , ConditionalFacts -> Maybe BadFaithKind
condBadFaith :: Maybe BadFaithKind
  } deriving (ConditionalFacts -> ConditionalFacts -> Bool
(ConditionalFacts -> ConditionalFacts -> Bool)
-> (ConditionalFacts -> ConditionalFacts -> Bool)
-> Eq ConditionalFacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConditionalFacts -> ConditionalFacts -> Bool
== :: ConditionalFacts -> ConditionalFacts -> Bool
$c/= :: ConditionalFacts -> ConditionalFacts -> Bool
/= :: ConditionalFacts -> ConditionalFacts -> Bool
Eq, Int -> ConditionalFacts -> ShowS
[ConditionalFacts] -> ShowS
ConditionalFacts -> String
(Int -> ConditionalFacts -> ShowS)
-> (ConditionalFacts -> String)
-> ([ConditionalFacts] -> ShowS)
-> Show ConditionalFacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConditionalFacts -> ShowS
showsPrec :: Int -> ConditionalFacts -> ShowS
$cshow :: ConditionalFacts -> String
show :: ConditionalFacts -> String
$cshowList :: [ConditionalFacts] -> ShowS
showList :: [ConditionalFacts] -> ShowS
Show)

-- | 민법 사실관계 (Korean Civil Act facts)
data CivilFact
  -- 인적 사항
  = IsNaturalPerson PersonId
  | IsJuristicPerson PersonId
  | IsMinor PersonId
  | IsAdult PersonId
  | HasGuardian PersonId PersonId
  | HasConsent PersonId ActId
  | PerformsAct PersonId ActId
  -- §5 단서
  | MerelyAcquiresRight
  -- §103, §104
  | ContraBonorsMores
  | ExploitativeAct
  -- §107
  | HiddenIntention
  | CounterpartyKnew
  -- §108
  | BonaFideThirdParty
  -- §109
  | GrossNegligence
  -- §110
  | ThirdPartyFraud
  | CounterpartyKnewFraud
  -- §118 대리
  | SelfDealing
  -- §125-129 표현대리
  | IndicatedAuthority        -- §125 대리권수여의 표시
  | ExceededScope              -- §126 권한을 넘은 행위
  | AuthorityExpired           -- §129 대리권 소멸
  -- §130, §132 무권대리
  | Ratified                   -- 추인
  | CounterpartyKnewNoAuthority  -- §134 상대방이 대리권 없음을 안 때
  | AgentIsLimitedCapacity       -- §135② 대리인이 제한능력자
  | CounterpartyCouldHaveKnown   -- §135② 상대방이 알 수 있었을 때
  -- §197, §200 점유 추정의 반증
  | BadFaith                   -- 악의 (반증: §197)
  | ViolentPossession          -- 강폭 점유 (반증: §197)
  | ClandestinePossession      -- 은비 점유 (반증: §197)
  | NoOwnershipIntent          -- 타주점유 (반증: §200)
  -- §186-188 물권변동
  | HasRegistration             -- 등기 완료
  | HasDelivery                 -- 인도 완료
  | IsRealProperty              -- 부동산
  | IsMovableProperty           -- 동산
  | ByInheritance               -- 상속에 의한 물권변동 (§187)
  | ByCourtOrder                -- 판결에 의한 물권변동 (§187)
  | ByPublicAuction             -- 공매에 의한 물권변동 (§187)
  | ByExpropriation             -- 수용에 의한 물권변동 (§187)
  deriving (CivilFact -> CivilFact -> Bool
(CivilFact -> CivilFact -> Bool)
-> (CivilFact -> CivilFact -> Bool) -> Eq CivilFact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CivilFact -> CivilFact -> Bool
== :: CivilFact -> CivilFact -> Bool
$c/= :: CivilFact -> CivilFact -> Bool
/= :: CivilFact -> CivilFact -> Bool
Eq, Eq CivilFact
Eq CivilFact =>
(CivilFact -> CivilFact -> Ordering)
-> (CivilFact -> CivilFact -> Bool)
-> (CivilFact -> CivilFact -> Bool)
-> (CivilFact -> CivilFact -> Bool)
-> (CivilFact -> CivilFact -> Bool)
-> (CivilFact -> CivilFact -> CivilFact)
-> (CivilFact -> CivilFact -> CivilFact)
-> Ord CivilFact
CivilFact -> CivilFact -> Bool
CivilFact -> CivilFact -> Ordering
CivilFact -> CivilFact -> CivilFact
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 :: CivilFact -> CivilFact -> Ordering
compare :: CivilFact -> CivilFact -> Ordering
$c< :: CivilFact -> CivilFact -> Bool
< :: CivilFact -> CivilFact -> Bool
$c<= :: CivilFact -> CivilFact -> Bool
<= :: CivilFact -> CivilFact -> Bool
$c> :: CivilFact -> CivilFact -> Bool
> :: CivilFact -> CivilFact -> Bool
$c>= :: CivilFact -> CivilFact -> Bool
>= :: CivilFact -> CivilFact -> Bool
$cmax :: CivilFact -> CivilFact -> CivilFact
max :: CivilFact -> CivilFact -> CivilFact
$cmin :: CivilFact -> CivilFact -> CivilFact
min :: CivilFact -> CivilFact -> CivilFact
Ord, Int -> CivilFact -> ShowS
[CivilFact] -> ShowS
CivilFact -> String
(Int -> CivilFact -> ShowS)
-> (CivilFact -> String)
-> ([CivilFact] -> ShowS)
-> Show CivilFact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CivilFact -> ShowS
showsPrec :: Int -> CivilFact -> ShowS
$cshow :: CivilFact -> String
show :: CivilFact -> String
$cshowList :: [CivilFact] -> ShowS
showList :: [CivilFact] -> ShowS
Show)

type instance Facts MinorAct    = Set CivilFact
type instance Facts JuristicAct = Set CivilFact
type instance Facts ShamAct     = Set CivilFact
type instance Facts MistakeAct  = Set CivilFact
type instance Facts FraudAct         = Set CivilFact
type instance Facts AuthAgencyAct    = Set CivilFact
type instance Facts UnauthAgencyAct  = Set CivilFact
type instance Facts PossessionAct    = Set CivilFact
type instance Facts PrescriptionAct  = PrescriptionFacts
type instance Facts CoOwnershipAct   = CoOwnershipFacts
type instance Facts TortAct          = TortFacts
type instance Facts RescissionAct    = RescissionFacts
type instance Facts PropertyTransferAct = Set CivilFact
type instance Facts AcqPrescriptionAct  = AcqPrescFacts
type instance Facts DefaultAct       = DefaultFacts
type instance Facts WarrantyAct      = WarrantyFacts
type instance Facts LeaseAct         = LeaseFacts
type instance Facts AgencyWithdrawalAct   = Set CivilFact
type instance Facts AgentLiabilityAct     = Set CivilFact
type instance Facts PartialInvalidityAct  = PartialInvalidityFacts
type instance Facts CancellableAct        = CancellationFacts
type instance Facts ConditionalAct        = ConditionalFacts

-- | Heterogeneous key for domain-specific fact records.
-- Each constructor determines the value type in the 'DMap'.
data DomainKey a where
  PrescriptionK :: DomainKey PrescriptionFacts
  TortK         :: DomainKey TortFacts
  CoOwnershipK  :: DomainKey CoOwnershipFacts
  RescissionK   :: DomainKey RescissionFacts
  AcqPrescK     :: DomainKey AcqPrescFacts
  DefaultK      :: DomainKey DefaultFacts
  WarrantyK     :: DomainKey WarrantyFacts
  LeaseK        :: DomainKey LeaseFacts
  InvalidityK   :: DomainKey PartialInvalidityFacts
  CancellationK :: DomainKey CancellationFacts
  ConditionalK  :: DomainKey ConditionalFacts

domainKeyTag :: DomainKey a -> Int
domainKeyTag :: forall a. DomainKey a -> Int
domainKeyTag DomainKey a
PrescriptionK = Int
0
domainKeyTag DomainKey a
TortK         = Int
1
domainKeyTag DomainKey a
CoOwnershipK  = Int
2
domainKeyTag DomainKey a
RescissionK   = Int
3
domainKeyTag DomainKey a
AcqPrescK     = Int
4
domainKeyTag DomainKey a
DefaultK      = Int
5
domainKeyTag DomainKey a
WarrantyK     = Int
6
domainKeyTag DomainKey a
LeaseK        = Int
7
domainKeyTag DomainKey a
InvalidityK   = Int
8
domainKeyTag DomainKey a
CancellationK = Int
9
domainKeyTag DomainKey a
ConditionalK  = Int
10

instance GEq DomainKey where
  geq :: forall a b. DomainKey a -> DomainKey b -> Maybe (a :~: b)
geq DomainKey a
PrescriptionK DomainKey b
PrescriptionK = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
TortK         DomainKey b
TortK         = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
CoOwnershipK  DomainKey b
CoOwnershipK  = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
RescissionK   DomainKey b
RescissionK   = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
AcqPrescK     DomainKey b
AcqPrescK     = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
DefaultK      DomainKey b
DefaultK      = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
WarrantyK     DomainKey b
WarrantyK     = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
LeaseK        DomainKey b
LeaseK        = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
InvalidityK   DomainKey b
InvalidityK   = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
CancellationK DomainKey b
CancellationK = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
ConditionalK  DomainKey b
ConditionalK  = (a :~: b) -> Maybe (a :~: b)
forall a. a -> Maybe a
Just a :~: a
a :~: b
forall {k} (a :: k). a :~: a
Refl
  geq DomainKey a
_             DomainKey b
_             = Maybe (a :~: b)
forall a. Maybe a
Nothing

instance GShow DomainKey where
  gshowsPrec :: forall a. Int -> DomainKey a -> ShowS
gshowsPrec Int
_ DomainKey a
PrescriptionK = String -> ShowS
showString String
"PrescriptionK"
  gshowsPrec Int
_ DomainKey a
TortK         = String -> ShowS
showString String
"TortK"
  gshowsPrec Int
_ DomainKey a
CoOwnershipK  = String -> ShowS
showString String
"CoOwnershipK"
  gshowsPrec Int
_ DomainKey a
RescissionK   = String -> ShowS
showString String
"RescissionK"
  gshowsPrec Int
_ DomainKey a
AcqPrescK     = String -> ShowS
showString String
"AcqPrescK"
  gshowsPrec Int
_ DomainKey a
DefaultK      = String -> ShowS
showString String
"DefaultK"
  gshowsPrec Int
_ DomainKey a
WarrantyK     = String -> ShowS
showString String
"WarrantyK"
  gshowsPrec Int
_ DomainKey a
LeaseK        = String -> ShowS
showString String
"LeaseK"
  gshowsPrec Int
_ DomainKey a
InvalidityK   = String -> ShowS
showString String
"InvalidityK"
  gshowsPrec Int
_ DomainKey a
CancellationK = String -> ShowS
showString String
"CancellationK"
  gshowsPrec Int
_ DomainKey a
ConditionalK  = String -> ShowS
showString String
"ConditionalK"

instance GCompare DomainKey where
  gcompare :: forall a b. DomainKey a -> DomainKey b -> GOrdering a b
gcompare DomainKey a
a DomainKey b
b = case Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (DomainKey a -> Int
forall a. DomainKey a -> Int
domainKeyTag DomainKey a
a) (DomainKey b -> Int
forall a. DomainKey a -> Int
domainKeyTag DomainKey b
b) of
    Ordering
LT -> GOrdering a b
forall {k} (a :: k) (b :: k). GOrdering a b
GLT
    Ordering
GT -> GOrdering a b
forall {k} (a :: k) (b :: k). GOrdering a b
GGT
    Ordering
EQ -> case DomainKey a -> DomainKey b -> Maybe (a :~: b)
forall a b. DomainKey a -> DomainKey b -> Maybe (a :~: b)
forall k (f :: k -> *) (a :: k) (b :: k).
GEq f =>
f a -> f b -> Maybe (a :~: b)
geq DomainKey a
a DomainKey b
b of
      Just a :~: b
Refl -> GOrdering a a
GOrdering a b
forall {k} (a :: k). GOrdering a a
GEQ
      Maybe (a :~: b)
Nothing   -> String -> GOrdering a b
forall a. HasCallStack => String -> a
error String
"DomainKey: tag collision (impossible)"