module Data.Schematic.Helpers where
import Data.Schematic.Schema
import GHC.TypeLits
type UUIDRegex =
'TRegex "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
type IsUUID = '[UUIDRegex]
type ISO8601Date = "[1-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])"
type ISO8601Time = "([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"
type ISO8601DateTime =
AppendSymbol
ISO8601Date
(AppendSymbol "(T" (AppendSymbol ISO8601Time ")?"))
type ISO8601UTC = "(Z|\\+00:00)"
type ISO8601DateTimeUTC =
AppendSymbol ISO8601Date (AppendSymbol "T" (AppendSymbol ISO8601Time ISO8601UTC))
type ISO8601TZ = "\\+[0-1][0-9]:[0-6][0-9]"
type ISO8601DateTimeZoned =
AppendSymbol ISO8601Date (AppendSymbol "T" (AppendSymbol ISO8601Time ISO8601TZ))
type ISO8601DateRegex = 'TRegex ISO8601Date
type ISO8601TimeRegex = 'TRegex ISO8601Time
type ISO8601DateTimeRegex = 'TRegex ISO8601DateTime
type ISO8601DateTimeRegexUTC = 'TRegex ISO8601DateTimeUTC
type ISO8601DateTimeRegexZoned = 'TRegex ISO8601DateTimeZoned
type IsDate = '[ISO8601DateRegex]
type IsTime = '[ISO8601TimeRegex]
type IsDateTime = '[ISO8601DateTimeRegex]
type IsZonedDateTime = '[ISO8601DateTimeRegexZoned]
type IsUTCDateTime = '[ISO8601DateTimeRegexUTC]