// Generated code. Do not modify. import Foundation import Serialization import VGSL public final class DivInputValidatorRegex: Sendable { public static let type: String = "regex" public let allowEmpty: Expression // default value: false public let labelId: Expression public let pattern: Expression public let variable: String public func resolveAllowEmpty(_ resolver: ExpressionResolver) -> Bool { resolver.resolveNumeric(allowEmpty) ?? false } public func resolveLabelId(_ resolver: ExpressionResolver) -> String? { resolver.resolveString(labelId) } public func resolvePattern(_ resolver: ExpressionResolver) -> String? { resolver.resolveString(pattern) } public convenience init(dictionary: [String: Any], context: ParsingContext) throws { self.init( allowEmpty: try dictionary.getOptionalExpressionField("allow_empty", context: context), labelId: try dictionary.getExpressionField("label_id", context: context), pattern: try dictionary.getExpressionField("pattern", context: context), variable: try dictionary.getField("variable", context: context) ) } init( allowEmpty: Expression? = nil, labelId: Expression, pattern: Expression, variable: String ) { self.allowEmpty = allowEmpty ?? .value(false) self.labelId = labelId self.pattern = pattern self.variable = variable } } #if DEBUG extension DivInputValidatorRegex: Equatable { public static func ==(lhs: DivInputValidatorRegex, rhs: DivInputValidatorRegex) -> Bool { guard lhs.allowEmpty == rhs.allowEmpty, lhs.labelId == rhs.labelId, lhs.pattern == rhs.pattern else { return false } guard lhs.variable == rhs.variable else { return false } return true } } #endif extension DivInputValidatorRegex: Serializable { @_optimize(size) public func toDictionary() -> [String: ValidSerializationValue] { var result: [String: ValidSerializationValue] = [:] result["type"] = Self.type result["allow_empty"] = allowEmpty.toValidSerializationValue() result["label_id"] = labelId.toValidSerializationValue() result["pattern"] = pattern.toValidSerializationValue() result["variable"] = variable return result } }