|
| 1 | +(ns quo.components.tags.context-tag.schema |
| 2 | + (:require [malli.core :as malli])) |
| 3 | + |
| 4 | +(def ^:private ?context-base |
| 5 | + [:map |
| 6 | + [:type {:optional true} |
| 7 | + [:maybe |
| 8 | + [:enum :default :multiuser :group :channel :community :token :network :multinetwork :account |
| 9 | + :collectible :address :icon :audio]]] |
| 10 | + [:customization-color {:optional true} [:maybe :schema.common/customization-color]] |
| 11 | + [:theme :schema.common/theme] |
| 12 | + [:blur? {:optional true} [:maybe :boolean]] |
| 13 | + [:state {:optional true} [:maybe [:enum :selected :default]]]]) |
| 14 | + |
| 15 | +(def ^:private ?size |
| 16 | + [:map |
| 17 | + [:size {:optional true} [:maybe [:enum 24 32]]]]) |
| 18 | + |
| 19 | +(def ^:private ?default |
| 20 | + [:map |
| 21 | + [:profile-picture {:optional true} [:maybe :schema.common/image-source]] |
| 22 | + [:full-name {:optional true} [:maybe :string]]]) |
| 23 | + |
| 24 | +(def ^:private ?multiuser |
| 25 | + [:map |
| 26 | + [:users {:optional true} |
| 27 | + [:maybe |
| 28 | + [:sequential |
| 29 | + [:map [:profile-picture {:optional true} [:maybe :schema.common/image-source]] |
| 30 | + [:full-name {:optional true} [:maybe :string]] |
| 31 | + [:customization-color {:optional true} [:maybe :schema.common/customization-color]]]]]]]) |
| 32 | + |
| 33 | +(def ^:private ?group |
| 34 | + [:map |
| 35 | + [:group-name {:optional true} [:maybe :string]]]) |
| 36 | + |
| 37 | +(def ^:private ?channel |
| 38 | + [:map |
| 39 | + [:community-name {:optional true} [:maybe :string]] |
| 40 | + [:channel-name {:optional true} [:maybe :string]]]) |
| 41 | + |
| 42 | +(def ^:private ?community |
| 43 | + [:map |
| 44 | + [:community-name {:optional true} [:maybe :string]]]) |
| 45 | + |
| 46 | +(def ^:private ?token |
| 47 | + [:map |
| 48 | + [:amount {:optional true} [:maybe [:or :string :int]]] |
| 49 | + [:token {:optional true} [:maybe :string]]]) |
| 50 | + |
| 51 | +(def ^:private ?network |
| 52 | + [:map |
| 53 | + [:network-logo {:optional true} [:maybe :schema.common/image-source]] |
| 54 | + [:network-name {:optional true} [:maybe :string]]]) |
| 55 | + |
| 56 | +(def ^:private ?multinetwork |
| 57 | + [:map |
| 58 | + [:networks {:optional true} [:maybe [:sequential ?network]]]]) |
| 59 | + |
| 60 | +(def ^:private ?account |
| 61 | + [:map |
| 62 | + [:account-name {:optional true} [:maybe :string]] |
| 63 | + [:emoji {:optional true} [:maybe :string]]]) |
| 64 | + |
| 65 | +(def ^:private ?collectible |
| 66 | + [:map |
| 67 | + [:collectible {:optional true} [:maybe :schema.common/image-source]] |
| 68 | + [:collectible-name {:optional true} [:maybe :string]] |
| 69 | + [:collectible-number {:optional true} [:maybe [:or :string :int]]]]) |
| 70 | + |
| 71 | +(def ^:private ?address |
| 72 | + [:map |
| 73 | + [:address {:optional true} [:maybe :string]]]) |
| 74 | + |
| 75 | +(def ^:private ?icon |
| 76 | + [:map |
| 77 | + [:icon {:optional true} [:maybe :keyword]] |
| 78 | + [:context {:optional true} [:maybe :string]]]) |
| 79 | + |
| 80 | +(def ^:private ?audio |
| 81 | + [:map |
| 82 | + [:duration {:optional true} [:maybe :string]]]) |
| 83 | + |
| 84 | +(def ?schema |
| 85 | + [:=> |
| 86 | + [:catn |
| 87 | + [:props |
| 88 | + [:multi {:dispatch :type} |
| 89 | + [::malli/default [:merge ?default ?size ?context-base]] |
| 90 | + [:default [:merge ?default ?size ?context-base]] |
| 91 | + [:multiuser [:merge ?multiuser ?context-base]] |
| 92 | + [:group [:merge ?group ?size ?context-base]] |
| 93 | + [:channel [:merge ?channel ?size ?context-base]] |
| 94 | + [:community [:merge ?community ?size ?context-base]] |
| 95 | + [:token [:merge ?token ?size ?context-base]] |
| 96 | + [:network [:merge ?network ?context-base]] |
| 97 | + [:multinetwork [:merge ?multinetwork ?context-base]] |
| 98 | + [:account [:merge ?account ?size ?context-base]] |
| 99 | + [:collectible [:merge ?collectible ?size ?context-base]] |
| 100 | + [:address [:merge ?address ?size ?context-base]] |
| 101 | + [:icon [:merge ?icon ?size ?context-base]] |
| 102 | + [:audio [:merge ?audio ?context-base]]]]] |
| 103 | + :any]) |
0 commit comments