commonMain.schemas.DateSchema.kt Maven / Gradle / Ivy
package pt.lightweightform.lfkotlin.schemas
import pt.lightweightform.lfkotlin.AllowedValues
import pt.lightweightform.lfkotlin.Bound
import pt.lightweightform.lfkotlin.ComputedValue
import pt.lightweightform.lfkotlin.InitialValue
import pt.lightweightform.lfkotlin.IsRequired
import pt.lightweightform.lfkotlin.LfDate
import pt.lightweightform.lfkotlin.Schema
import pt.lightweightform.lfkotlin.Validation
internal expect fun dateSchemaImpl(
isNullable: Boolean,
initialValue: LfDate?,
computedInitialValue: InitialValue?,
computedValue: ComputedValue?,
mismatchedComputedCode: String?,
isClientOnly: Boolean?,
isRequired: Boolean?,
computedIsRequired: IsRequired?,
isRequiredCode: String?,
allowedValues: List?,
computedAllowedValues: AllowedValues?,
disallowedValueCode: String?,
minDate: LfDate?,
computedMinDate: Bound?,
minDateCode: String?,
maxDate: LfDate?,
computedMaxDate: Bound?,
maxDateCode: String?,
validations: List>?,
initialState: Map?,
extra: Map?
): Schema
/** Creates a date schema. Maps to a schema of type "date" in LF. */
@Suppress("UNCHECKED_CAST")
public fun dateSchema(
initialValue: LfDate? = null,
computedInitialValue: InitialValue? = null,
computedValue: ComputedValue? = null,
mismatchedComputedCode: String? = null,
isClientOnly: Boolean? = null,
allowedValues: List? = null,
computedAllowedValues: AllowedValues? = null,
disallowedValueCode: String? = null,
minDate: LfDate? = null,
computedMinDate: Bound? = null,
minDateCode: String? = null,
maxDate: LfDate? = null,
computedMaxDate: Bound? = null,
maxDateCode: String? = null,
validations: List>? = null,
initialState: Map? = null,
extra: Map? = null
): Schema =
dateSchemaImpl(
false,
initialValue,
computedInitialValue,
computedValue as ComputedValue?,
mismatchedComputedCode,
isClientOnly,
null,
null,
null,
allowedValues,
computedAllowedValues,
disallowedValueCode,
minDate,
computedMinDate,
minDateCode,
maxDate,
computedMaxDate,
maxDateCode,
validations,
initialState,
extra
) as
Schema
/**
* Creates a nullable date schema. Maps to a schema of type "date" with `isNullable` set to `true`
* in LF.
*/
@Suppress("UNCHECKED_CAST")
public fun nullableDateSchema(
initialValue: LfDate? = null,
computedInitialValue: InitialValue? = null,
computedValue: ComputedValue? = null,
mismatchedComputedCode: String? = null,
isClientOnly: Boolean? = null,
isRequired: Boolean? = null,
computedIsRequired: IsRequired? = null,
isRequiredCode: String? = null,
allowedValues: List? = null,
computedAllowedValues: AllowedValues? = null,
disallowedValueCode: String? = null,
minDate: LfDate? = null,
computedMinDate: Bound? = null,
minDateCode: String? = null,
maxDate: LfDate? = null,
computedMaxDate: Bound? = null,
maxDateCode: String? = null,
validations: List>? = null,
initialState: Map? = null,
extra: Map? = null
): Schema =
dateSchemaImpl(
true,
initialValue,
computedInitialValue,
computedValue,
mismatchedComputedCode,
isClientOnly,
isRequired,
computedIsRequired,
isRequiredCode,
allowedValues,
computedAllowedValues,
disallowedValueCode,
minDate,
computedMinDate,
minDateCode,
maxDate,
computedMaxDate,
maxDateCode,
validations,
initialState,
extra
)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy