------------------------------------------------------------------------
-- A definition related to the mode instance Zero-one.
------------------------------------------------------------------------

import Graded.Modality

module Graded.Mode.Instances.Zero-one.Variant
  {a} {M : Set a}
  (open Graded.Modality M)
  (๐•„ : Modality)
  where

open Modality ๐•„

open import Tools.Bool

------------------------------------------------------------------------
-- The mode variant, either a single mode or two modes.

record Mode-variant : Set a where
  no-eta-equality
  field
    -- Does the mode ๐Ÿ˜แต exist?
    ๐Ÿ˜แต-allowed : Bool
    -- If mode ๐Ÿ˜แต exists the modality is assumed to have a well-behaved
    -- zero.
    ๐Ÿ˜-well-behaved :
      T ๐Ÿ˜แต-allowed โ†’ Has-well-behaved-zero ๐•„

------------------------------------------------------------------------
-- Mode variant instances


-- A mode variant for which ๐Ÿ˜แต is allowed if the boolean is true.

๐Ÿ˜แต-allowed-if : (b : Bool) โ†’ (T b โ†’ Has-well-behaved-zero ๐•„) โ†’ Mode-variant
๐Ÿ˜แต-allowed-if b ok = record
  { ๐Ÿ˜แต-allowed = b ; ๐Ÿ˜-well-behaved = ok }

-- A mode variant for which ๐Ÿ˜แต is allowed.

๐Ÿ˜แต-Allowed : โฆƒ ok : Has-well-behaved-zero ๐•„ โฆ„ โ†’ Mode-variant
๐Ÿ˜แต-Allowed โฆƒ ok โฆ„ = ๐Ÿ˜แต-allowed-if true ฮป _ โ†’ ok

-- A mode variant for which ๐Ÿ˜แต is not allowed.

๐Ÿ˜แต-Not-Allowed : Mode-variant
๐Ÿ˜แต-Not-Allowed = ๐Ÿ˜แต-allowed-if false (ฮป ())