// Generated code. Do not modify. import Foundation import Serialization import VGSL public final class DivTextTemplate: TemplateValue, @unchecked Sendable { public final class EllipsisTemplate: TemplateValue, Sendable { public let actions: Field<[DivActionTemplate]>? public let images: Field<[ImageTemplate]>? public let ranges: Field<[RangeTemplate]>? public let text: Field>? public convenience init(dictionary: [String: Any], templateToType: [TemplateName: String]) throws { self.init( actions: dictionary.getOptionalArray("actions", templateToType: templateToType), images: dictionary.getOptionalArray("images", templateToType: templateToType), ranges: dictionary.getOptionalArray("ranges", templateToType: templateToType), text: dictionary.getOptionalExpressionField("text") ) } init( actions: Field<[DivActionTemplate]>? = nil, images: Field<[ImageTemplate]>? = nil, ranges: Field<[RangeTemplate]>? = nil, text: Field>? = nil ) { self.actions = actions self.images = images self.ranges = ranges self.text = text } private static func resolveOnlyLinks(context: TemplatesContext, parent: EllipsisTemplate?) -> DeserializationResult { let actionsValue = parent?.actions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let imagesValue = parent?.images?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let rangesValue = parent?.ranges?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let textValue = parent?.text?.resolveValue(context: context) ?? .noValue var errors = mergeErrors( actionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "actions", error: $0) }, imagesValue.errorsOrWarnings?.map { .nestedObjectError(field: "images", error: $0) }, rangesValue.errorsOrWarnings?.map { .nestedObjectError(field: "ranges", error: $0) }, textValue.errorsOrWarnings?.map { .nestedObjectError(field: "text", error: $0) } ) if case .noValue = textValue { errors.append(.requiredFieldIsMissing(field: "text")) } guard let textNonNil = textValue.value else { return .failure(NonEmptyArray(errors)!) } let result = DivText.Ellipsis( actions: actionsValue.value, images: imagesValue.value, ranges: rangesValue.value, text: textNonNil ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } public static func resolveValue(context: TemplatesContext, parent: EllipsisTemplate?, useOnlyLinks: Bool) -> DeserializationResult { if useOnlyLinks { return resolveOnlyLinks(context: context, parent: parent) } var actionsValue: DeserializationResult<[DivAction]> = .noValue var imagesValue: DeserializationResult<[DivText.Image]> = .noValue var rangesValue: DeserializationResult<[DivText.Range]> = .noValue var textValue: DeserializationResult> = parent?.text?.value() ?? .noValue context.templateData.forEach { key, __dictValue in switch key { case "actions": actionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: actionsValue) case "images": imagesValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.ImageTemplate.self).merged(with: imagesValue) case "ranges": rangesValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.RangeTemplate.self).merged(with: rangesValue) case "text": textValue = deserialize(__dictValue).merged(with: textValue) case parent?.actions?.link: actionsValue = actionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.images?.link: imagesValue = imagesValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.ImageTemplate.self) }) case parent?.ranges?.link: rangesValue = rangesValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.RangeTemplate.self) }) case parent?.text?.link: textValue = textValue.merged(with: { deserialize(__dictValue) }) default: break } } if let parent = parent { _ = actionsValue = actionsValue.merged(with: { parent.actions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = imagesValue = imagesValue.merged(with: { parent.images?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = rangesValue = rangesValue.merged(with: { parent.ranges?.resolveOptionalValue(context: context, useOnlyLinks: true) }) } var errors = mergeErrors( actionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "actions", error: $0) }, imagesValue.errorsOrWarnings?.map { .nestedObjectError(field: "images", error: $0) }, rangesValue.errorsOrWarnings?.map { .nestedObjectError(field: "ranges", error: $0) }, textValue.errorsOrWarnings?.map { .nestedObjectError(field: "text", error: $0) } ) if case .noValue = textValue { errors.append(.requiredFieldIsMissing(field: "text")) } guard let textNonNil = textValue.value else { return .failure(NonEmptyArray(errors)!) } let result = DivText.Ellipsis( actions: actionsValue.value, images: imagesValue.value, ranges: rangesValue.value, text: textNonNil ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } private func mergedWithParent(templates: [TemplateName: Any]) throws -> EllipsisTemplate { return self } public func resolveParent(templates: [TemplateName: Any]) throws -> EllipsisTemplate { let merged = try mergedWithParent(templates: templates) return EllipsisTemplate( actions: merged.actions?.tryResolveParent(templates: templates), images: merged.images?.tryResolveParent(templates: templates), ranges: merged.ranges?.tryResolveParent(templates: templates), text: merged.text ) } } public final class ImageTemplate: TemplateValue, Sendable { public final class AccessibilityTemplate: TemplateValue, Sendable { public typealias Kind = DivText.Image.Accessibility.Kind public let description: Field>? public let type: Field? // default value: auto public convenience init(dictionary: [String: Any], templateToType: [TemplateName: String]) throws { self.init( description: dictionary.getOptionalExpressionField("description"), type: dictionary.getOptionalField("type") ) } init( description: Field>? = nil, type: Field? = nil ) { self.description = description self.type = type } private static func resolveOnlyLinks(context: TemplatesContext, parent: AccessibilityTemplate?) -> DeserializationResult { let descriptionValue = parent?.description?.resolveOptionalValue(context: context) ?? .noValue let typeValue = parent?.type?.resolveOptionalValue(context: context) ?? .noValue let errors = mergeErrors( descriptionValue.errorsOrWarnings?.map { .nestedObjectError(field: "description", error: $0) }, typeValue.errorsOrWarnings?.map { .nestedObjectError(field: "type", error: $0) } ) let result = DivText.Image.Accessibility( description: descriptionValue.value, type: typeValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } public static func resolveValue(context: TemplatesContext, parent: AccessibilityTemplate?, useOnlyLinks: Bool) -> DeserializationResult { if useOnlyLinks { return resolveOnlyLinks(context: context, parent: parent) } var descriptionValue: DeserializationResult> = parent?.description?.value() ?? .noValue var typeValue: DeserializationResult = parent?.type?.value() ?? .noValue context.templateData.forEach { key, __dictValue in switch key { case "description": descriptionValue = deserialize(__dictValue).merged(with: descriptionValue) case "type": typeValue = deserialize(__dictValue).merged(with: typeValue) case parent?.description?.link: descriptionValue = descriptionValue.merged(with: { deserialize(__dictValue) }) case parent?.type?.link: typeValue = typeValue.merged(with: { deserialize(__dictValue) }) default: break } } let errors = mergeErrors( descriptionValue.errorsOrWarnings?.map { .nestedObjectError(field: "description", error: $0) }, typeValue.errorsOrWarnings?.map { .nestedObjectError(field: "type", error: $0) } ) let result = DivText.Image.Accessibility( description: descriptionValue.value, type: typeValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } private func mergedWithParent(templates: [TemplateName: Any]) throws -> AccessibilityTemplate { return self } public func resolveParent(templates: [TemplateName: Any]) throws -> AccessibilityTemplate { return try mergedWithParent(templates: templates) } } public typealias IndexingDirection = DivText.Image.IndexingDirection public let accessibility: Field? public let alignmentVertical: Field>? // default value: center public let height: Field? // default value: DivFixedSize(value: .value(20)) public let indexingDirection: Field>? // default value: normal public let preloadRequired: Field>? // default value: false public let start: Field>? // constraint: number >= 0 public let tintColor: Field>? public let tintMode: Field>? // default value: source_in public let url: Field>? public let width: Field? // default value: DivFixedSize(value: .value(20)) public convenience init(dictionary: [String: Any], templateToType: [TemplateName: String]) throws { self.init( accessibility: dictionary.getOptionalField("accessibility", templateToType: templateToType), alignmentVertical: dictionary.getOptionalExpressionField("alignment_vertical"), height: dictionary.getOptionalField("height", templateToType: templateToType), indexingDirection: dictionary.getOptionalExpressionField("indexing_direction"), preloadRequired: dictionary.getOptionalExpressionField("preload_required"), start: dictionary.getOptionalExpressionField("start"), tintColor: dictionary.getOptionalExpressionField("tint_color", transform: Color.color(withHexString:)), tintMode: dictionary.getOptionalExpressionField("tint_mode"), url: dictionary.getOptionalExpressionField("url", transform: URL.makeFromNonEncodedString), width: dictionary.getOptionalField("width", templateToType: templateToType) ) } init( accessibility: Field? = nil, alignmentVertical: Field>? = nil, height: Field? = nil, indexingDirection: Field>? = nil, preloadRequired: Field>? = nil, start: Field>? = nil, tintColor: Field>? = nil, tintMode: Field>? = nil, url: Field>? = nil, width: Field? = nil ) { self.accessibility = accessibility self.alignmentVertical = alignmentVertical self.height = height self.indexingDirection = indexingDirection self.preloadRequired = preloadRequired self.start = start self.tintColor = tintColor self.tintMode = tintMode self.url = url self.width = width } private static func resolveOnlyLinks(context: TemplatesContext, parent: ImageTemplate?) -> DeserializationResult { let accessibilityValue = parent?.accessibility?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let alignmentVerticalValue = parent?.alignmentVertical?.resolveOptionalValue(context: context) ?? .noValue let heightValue = parent?.height?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let indexingDirectionValue = parent?.indexingDirection?.resolveOptionalValue(context: context) ?? .noValue let preloadRequiredValue = parent?.preloadRequired?.resolveOptionalValue(context: context) ?? .noValue let startValue = parent?.start?.resolveValue(context: context, validator: ResolvedValue.startValidator) ?? .noValue let tintColorValue = parent?.tintColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue let tintModeValue = parent?.tintMode?.resolveOptionalValue(context: context) ?? .noValue let urlValue = parent?.url?.resolveValue(context: context, transform: URL.makeFromNonEncodedString) ?? .noValue let widthValue = parent?.width?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue var errors = mergeErrors( accessibilityValue.errorsOrWarnings?.map { .nestedObjectError(field: "accessibility", error: $0) }, alignmentVerticalValue.errorsOrWarnings?.map { .nestedObjectError(field: "alignment_vertical", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, indexingDirectionValue.errorsOrWarnings?.map { .nestedObjectError(field: "indexing_direction", error: $0) }, preloadRequiredValue.errorsOrWarnings?.map { .nestedObjectError(field: "preload_required", error: $0) }, startValue.errorsOrWarnings?.map { .nestedObjectError(field: "start", error: $0) }, tintColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "tint_color", error: $0) }, tintModeValue.errorsOrWarnings?.map { .nestedObjectError(field: "tint_mode", error: $0) }, urlValue.errorsOrWarnings?.map { .nestedObjectError(field: "url", error: $0) }, widthValue.errorsOrWarnings?.map { .nestedObjectError(field: "width", error: $0) } ) if case .noValue = startValue { errors.append(.requiredFieldIsMissing(field: "start")) } if case .noValue = urlValue { errors.append(.requiredFieldIsMissing(field: "url")) } guard let startNonNil = startValue.value, let urlNonNil = urlValue.value else { return .failure(NonEmptyArray(errors)!) } let result = DivText.Image( accessibility: accessibilityValue.value, alignmentVertical: alignmentVerticalValue.value, height: heightValue.value, indexingDirection: indexingDirectionValue.value, preloadRequired: preloadRequiredValue.value, start: startNonNil, tintColor: tintColorValue.value, tintMode: tintModeValue.value, url: urlNonNil, width: widthValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } public static func resolveValue(context: TemplatesContext, parent: ImageTemplate?, useOnlyLinks: Bool) -> DeserializationResult { if useOnlyLinks { return resolveOnlyLinks(context: context, parent: parent) } var accessibilityValue: DeserializationResult = .noValue var alignmentVerticalValue: DeserializationResult> = parent?.alignmentVertical?.value() ?? .noValue var heightValue: DeserializationResult = .noValue var indexingDirectionValue: DeserializationResult> = parent?.indexingDirection?.value() ?? .noValue var preloadRequiredValue: DeserializationResult> = parent?.preloadRequired?.value() ?? .noValue var startValue: DeserializationResult> = parent?.start?.value() ?? .noValue var tintColorValue: DeserializationResult> = parent?.tintColor?.value() ?? .noValue var tintModeValue: DeserializationResult> = parent?.tintMode?.value() ?? .noValue var urlValue: DeserializationResult> = parent?.url?.value() ?? .noValue var widthValue: DeserializationResult = .noValue context.templateData.forEach { key, __dictValue in switch key { case "accessibility": accessibilityValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.ImageTemplate.AccessibilityTemplate.self).merged(with: accessibilityValue) case "alignment_vertical": alignmentVerticalValue = deserialize(__dictValue).merged(with: alignmentVerticalValue) case "height": heightValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivFixedSizeTemplate.self).merged(with: heightValue) case "indexing_direction": indexingDirectionValue = deserialize(__dictValue).merged(with: indexingDirectionValue) case "preload_required": preloadRequiredValue = deserialize(__dictValue).merged(with: preloadRequiredValue) case "start": startValue = deserialize(__dictValue, validator: ResolvedValue.startValidator).merged(with: startValue) case "tint_color": tintColorValue = deserialize(__dictValue, transform: Color.color(withHexString:)).merged(with: tintColorValue) case "tint_mode": tintModeValue = deserialize(__dictValue).merged(with: tintModeValue) case "url": urlValue = deserialize(__dictValue, transform: URL.makeFromNonEncodedString).merged(with: urlValue) case "width": widthValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivFixedSizeTemplate.self).merged(with: widthValue) case parent?.accessibility?.link: accessibilityValue = accessibilityValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.ImageTemplate.AccessibilityTemplate.self) }) case parent?.alignmentVertical?.link: alignmentVerticalValue = alignmentVerticalValue.merged(with: { deserialize(__dictValue) }) case parent?.height?.link: heightValue = heightValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivFixedSizeTemplate.self) }) case parent?.indexingDirection?.link: indexingDirectionValue = indexingDirectionValue.merged(with: { deserialize(__dictValue) }) case parent?.preloadRequired?.link: preloadRequiredValue = preloadRequiredValue.merged(with: { deserialize(__dictValue) }) case parent?.start?.link: startValue = startValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.startValidator) }) case parent?.tintColor?.link: tintColorValue = tintColorValue.merged(with: { deserialize(__dictValue, transform: Color.color(withHexString:)) }) case parent?.tintMode?.link: tintModeValue = tintModeValue.merged(with: { deserialize(__dictValue) }) case parent?.url?.link: urlValue = urlValue.merged(with: { deserialize(__dictValue, transform: URL.makeFromNonEncodedString) }) case parent?.width?.link: widthValue = widthValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivFixedSizeTemplate.self) }) default: break } } if let parent = parent { _ = accessibilityValue = accessibilityValue.merged(with: { parent.accessibility?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = heightValue = heightValue.merged(with: { parent.height?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = widthValue = widthValue.merged(with: { parent.width?.resolveOptionalValue(context: context, useOnlyLinks: true) }) } var errors = mergeErrors( accessibilityValue.errorsOrWarnings?.map { .nestedObjectError(field: "accessibility", error: $0) }, alignmentVerticalValue.errorsOrWarnings?.map { .nestedObjectError(field: "alignment_vertical", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, indexingDirectionValue.errorsOrWarnings?.map { .nestedObjectError(field: "indexing_direction", error: $0) }, preloadRequiredValue.errorsOrWarnings?.map { .nestedObjectError(field: "preload_required", error: $0) }, startValue.errorsOrWarnings?.map { .nestedObjectError(field: "start", error: $0) }, tintColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "tint_color", error: $0) }, tintModeValue.errorsOrWarnings?.map { .nestedObjectError(field: "tint_mode", error: $0) }, urlValue.errorsOrWarnings?.map { .nestedObjectError(field: "url", error: $0) }, widthValue.errorsOrWarnings?.map { .nestedObjectError(field: "width", error: $0) } ) if case .noValue = startValue { errors.append(.requiredFieldIsMissing(field: "start")) } if case .noValue = urlValue { errors.append(.requiredFieldIsMissing(field: "url")) } guard let startNonNil = startValue.value, let urlNonNil = urlValue.value else { return .failure(NonEmptyArray(errors)!) } let result = DivText.Image( accessibility: accessibilityValue.value, alignmentVertical: alignmentVerticalValue.value, height: heightValue.value, indexingDirection: indexingDirectionValue.value, preloadRequired: preloadRequiredValue.value, start: startNonNil, tintColor: tintColorValue.value, tintMode: tintModeValue.value, url: urlNonNil, width: widthValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } private func mergedWithParent(templates: [TemplateName: Any]) throws -> ImageTemplate { return self } public func resolveParent(templates: [TemplateName: Any]) throws -> ImageTemplate { let merged = try mergedWithParent(templates: templates) return ImageTemplate( accessibility: merged.accessibility?.tryResolveParent(templates: templates), alignmentVertical: merged.alignmentVertical, height: merged.height?.tryResolveParent(templates: templates), indexingDirection: merged.indexingDirection, preloadRequired: merged.preloadRequired, start: merged.start, tintColor: merged.tintColor, tintMode: merged.tintMode, url: merged.url, width: merged.width?.tryResolveParent(templates: templates) ) } } public final class RangeTemplate: TemplateValue, @unchecked Sendable { public let actions: Field<[DivActionTemplate]>? public let alignmentVertical: Field>? public let background: Field? public let baselineOffset: Field>? // default value: 0 public let border: Field? public let end: Field>? // constraint: number > 0 public let fontFamily: Field>? public let fontFeatureSettings: Field>? public let fontSize: Field>? // constraint: number >= 0 public let fontSizeUnit: Field>? // default value: sp public let fontVariationSettings: Field>? public let fontWeight: Field>? public let fontWeightValue: Field>? // constraint: number > 0 public let letterSpacing: Field>? public let lineHeight: Field>? // constraint: number >= 0 public let mask: Field? public let start: Field>? // constraint: number >= 0; default value: 0 public let strike: Field>? public let textColor: Field>? public let textShadow: Field? public let topOffset: Field>? // constraint: number >= 0 public let underline: Field>? public convenience init(dictionary: [String: Any], templateToType: [TemplateName: String]) throws { self.init( actions: dictionary.getOptionalArray("actions", templateToType: templateToType), alignmentVertical: dictionary.getOptionalExpressionField("alignment_vertical"), background: dictionary.getOptionalField("background", templateToType: templateToType), baselineOffset: dictionary.getOptionalExpressionField("baseline_offset"), border: dictionary.getOptionalField("border", templateToType: templateToType), end: dictionary.getOptionalExpressionField("end"), fontFamily: dictionary.getOptionalExpressionField("font_family"), fontFeatureSettings: dictionary.getOptionalExpressionField("font_feature_settings"), fontSize: dictionary.getOptionalExpressionField("font_size"), fontSizeUnit: dictionary.getOptionalExpressionField("font_size_unit"), fontVariationSettings: dictionary.getOptionalExpressionField("font_variation_settings"), fontWeight: dictionary.getOptionalExpressionField("font_weight"), fontWeightValue: dictionary.getOptionalExpressionField("font_weight_value"), letterSpacing: dictionary.getOptionalExpressionField("letter_spacing"), lineHeight: dictionary.getOptionalExpressionField("line_height"), mask: dictionary.getOptionalField("mask", templateToType: templateToType), start: dictionary.getOptionalExpressionField("start"), strike: dictionary.getOptionalExpressionField("strike"), textColor: dictionary.getOptionalExpressionField("text_color", transform: Color.color(withHexString:)), textShadow: dictionary.getOptionalField("text_shadow", templateToType: templateToType), topOffset: dictionary.getOptionalExpressionField("top_offset"), underline: dictionary.getOptionalExpressionField("underline") ) } init( actions: Field<[DivActionTemplate]>? = nil, alignmentVertical: Field>? = nil, background: Field? = nil, baselineOffset: Field>? = nil, border: Field? = nil, end: Field>? = nil, fontFamily: Field>? = nil, fontFeatureSettings: Field>? = nil, fontSize: Field>? = nil, fontSizeUnit: Field>? = nil, fontVariationSettings: Field>? = nil, fontWeight: Field>? = nil, fontWeightValue: Field>? = nil, letterSpacing: Field>? = nil, lineHeight: Field>? = nil, mask: Field? = nil, start: Field>? = nil, strike: Field>? = nil, textColor: Field>? = nil, textShadow: Field? = nil, topOffset: Field>? = nil, underline: Field>? = nil ) { self.actions = actions self.alignmentVertical = alignmentVertical self.background = background self.baselineOffset = baselineOffset self.border = border self.end = end self.fontFamily = fontFamily self.fontFeatureSettings = fontFeatureSettings self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit self.fontVariationSettings = fontVariationSettings self.fontWeight = fontWeight self.fontWeightValue = fontWeightValue self.letterSpacing = letterSpacing self.lineHeight = lineHeight self.mask = mask self.start = start self.strike = strike self.textColor = textColor self.textShadow = textShadow self.topOffset = topOffset self.underline = underline } private static func resolveOnlyLinks(context: TemplatesContext, parent: RangeTemplate?) -> DeserializationResult { let actionsValue = parent?.actions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let alignmentVerticalValue = parent?.alignmentVertical?.resolveOptionalValue(context: context) ?? .noValue let backgroundValue = parent?.background?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let baselineOffsetValue = parent?.baselineOffset?.resolveOptionalValue(context: context) ?? .noValue let borderValue = parent?.border?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let endValue = parent?.end?.resolveOptionalValue(context: context, validator: ResolvedValue.endValidator) ?? .noValue let fontFamilyValue = parent?.fontFamily?.resolveOptionalValue(context: context) ?? .noValue let fontFeatureSettingsValue = parent?.fontFeatureSettings?.resolveOptionalValue(context: context) ?? .noValue let fontSizeValue = parent?.fontSize?.resolveOptionalValue(context: context, validator: ResolvedValue.fontSizeValidator) ?? .noValue let fontSizeUnitValue = parent?.fontSizeUnit?.resolveOptionalValue(context: context) ?? .noValue let fontVariationSettingsValue = parent?.fontVariationSettings?.resolveOptionalValue(context: context) ?? .noValue let fontWeightValue = parent?.fontWeight?.resolveOptionalValue(context: context) ?? .noValue let fontWeightValueValue = parent?.fontWeightValue?.resolveOptionalValue(context: context, validator: ResolvedValue.fontWeightValueValidator) ?? .noValue let letterSpacingValue = parent?.letterSpacing?.resolveOptionalValue(context: context) ?? .noValue let lineHeightValue = parent?.lineHeight?.resolveOptionalValue(context: context, validator: ResolvedValue.lineHeightValidator) ?? .noValue let maskValue = parent?.mask?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let startValue = parent?.start?.resolveOptionalValue(context: context, validator: ResolvedValue.startValidator) ?? .noValue let strikeValue = parent?.strike?.resolveOptionalValue(context: context) ?? .noValue let textColorValue = parent?.textColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue let textShadowValue = parent?.textShadow?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let topOffsetValue = parent?.topOffset?.resolveOptionalValue(context: context, validator: ResolvedValue.topOffsetValidator) ?? .noValue let underlineValue = parent?.underline?.resolveOptionalValue(context: context) ?? .noValue let errors = mergeErrors( actionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "actions", error: $0) }, alignmentVerticalValue.errorsOrWarnings?.map { .nestedObjectError(field: "alignment_vertical", error: $0) }, backgroundValue.errorsOrWarnings?.map { .nestedObjectError(field: "background", error: $0) }, baselineOffsetValue.errorsOrWarnings?.map { .nestedObjectError(field: "baseline_offset", error: $0) }, borderValue.errorsOrWarnings?.map { .nestedObjectError(field: "border", error: $0) }, endValue.errorsOrWarnings?.map { .nestedObjectError(field: "end", error: $0) }, fontFamilyValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_family", error: $0) }, fontFeatureSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_feature_settings", error: $0) }, fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontVariationSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_variation_settings", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, letterSpacingValue.errorsOrWarnings?.map { .nestedObjectError(field: "letter_spacing", error: $0) }, lineHeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "line_height", error: $0) }, maskValue.errorsOrWarnings?.map { .nestedObjectError(field: "mask", error: $0) }, startValue.errorsOrWarnings?.map { .nestedObjectError(field: "start", error: $0) }, strikeValue.errorsOrWarnings?.map { .nestedObjectError(field: "strike", error: $0) }, textColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_color", error: $0) }, textShadowValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_shadow", error: $0) }, topOffsetValue.errorsOrWarnings?.map { .nestedObjectError(field: "top_offset", error: $0) }, underlineValue.errorsOrWarnings?.map { .nestedObjectError(field: "underline", error: $0) } ) let result = DivText.Range( actions: actionsValue.value, alignmentVertical: alignmentVerticalValue.value, background: backgroundValue.value, baselineOffset: baselineOffsetValue.value, border: borderValue.value, end: endValue.value, fontFamily: fontFamilyValue.value, fontFeatureSettings: fontFeatureSettingsValue.value, fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontVariationSettings: fontVariationSettingsValue.value, fontWeight: fontWeightValue.value, fontWeightValue: fontWeightValueValue.value, letterSpacing: letterSpacingValue.value, lineHeight: lineHeightValue.value, mask: maskValue.value, start: startValue.value, strike: strikeValue.value, textColor: textColorValue.value, textShadow: textShadowValue.value, topOffset: topOffsetValue.value, underline: underlineValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } public static func resolveValue(context: TemplatesContext, parent: RangeTemplate?, useOnlyLinks: Bool) -> DeserializationResult { if useOnlyLinks { return resolveOnlyLinks(context: context, parent: parent) } var actionsValue: DeserializationResult<[DivAction]> = .noValue var alignmentVerticalValue: DeserializationResult> = parent?.alignmentVertical?.value() ?? .noValue var backgroundValue: DeserializationResult = .noValue var baselineOffsetValue: DeserializationResult> = parent?.baselineOffset?.value() ?? .noValue var borderValue: DeserializationResult = .noValue var endValue: DeserializationResult> = parent?.end?.value() ?? .noValue var fontFamilyValue: DeserializationResult> = parent?.fontFamily?.value() ?? .noValue var fontFeatureSettingsValue: DeserializationResult> = parent?.fontFeatureSettings?.value() ?? .noValue var fontSizeValue: DeserializationResult> = parent?.fontSize?.value() ?? .noValue var fontSizeUnitValue: DeserializationResult> = parent?.fontSizeUnit?.value() ?? .noValue var fontVariationSettingsValue: DeserializationResult> = parent?.fontVariationSettings?.value() ?? .noValue var fontWeightValue: DeserializationResult> = parent?.fontWeight?.value() ?? .noValue var fontWeightValueValue: DeserializationResult> = parent?.fontWeightValue?.value() ?? .noValue var letterSpacingValue: DeserializationResult> = parent?.letterSpacing?.value() ?? .noValue var lineHeightValue: DeserializationResult> = parent?.lineHeight?.value() ?? .noValue var maskValue: DeserializationResult = .noValue var startValue: DeserializationResult> = parent?.start?.value() ?? .noValue var strikeValue: DeserializationResult> = parent?.strike?.value() ?? .noValue var textColorValue: DeserializationResult> = parent?.textColor?.value() ?? .noValue var textShadowValue: DeserializationResult = .noValue var topOffsetValue: DeserializationResult> = parent?.topOffset?.value() ?? .noValue var underlineValue: DeserializationResult> = parent?.underline?.value() ?? .noValue context.templateData.forEach { key, __dictValue in switch key { case "actions": actionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: actionsValue) case "alignment_vertical": alignmentVerticalValue = deserialize(__dictValue).merged(with: alignmentVerticalValue) case "background": backgroundValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextRangeBackgroundTemplate.self).merged(with: backgroundValue) case "baseline_offset": baselineOffsetValue = deserialize(__dictValue).merged(with: baselineOffsetValue) case "border": borderValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextRangeBorderTemplate.self).merged(with: borderValue) case "end": endValue = deserialize(__dictValue, validator: ResolvedValue.endValidator).merged(with: endValue) case "font_family": fontFamilyValue = deserialize(__dictValue).merged(with: fontFamilyValue) case "font_feature_settings": fontFeatureSettingsValue = deserialize(__dictValue).merged(with: fontFeatureSettingsValue) case "font_size": fontSizeValue = deserialize(__dictValue, validator: ResolvedValue.fontSizeValidator).merged(with: fontSizeValue) case "font_size_unit": fontSizeUnitValue = deserialize(__dictValue).merged(with: fontSizeUnitValue) case "font_variation_settings": fontVariationSettingsValue = deserialize(__dictValue).merged(with: fontVariationSettingsValue) case "font_weight": fontWeightValue = deserialize(__dictValue).merged(with: fontWeightValue) case "font_weight_value": fontWeightValueValue = deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator).merged(with: fontWeightValueValue) case "letter_spacing": letterSpacingValue = deserialize(__dictValue).merged(with: letterSpacingValue) case "line_height": lineHeightValue = deserialize(__dictValue, validator: ResolvedValue.lineHeightValidator).merged(with: lineHeightValue) case "mask": maskValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextRangeMaskTemplate.self).merged(with: maskValue) case "start": startValue = deserialize(__dictValue, validator: ResolvedValue.startValidator).merged(with: startValue) case "strike": strikeValue = deserialize(__dictValue).merged(with: strikeValue) case "text_color": textColorValue = deserialize(__dictValue, transform: Color.color(withHexString:)).merged(with: textColorValue) case "text_shadow": textShadowValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivShadowTemplate.self).merged(with: textShadowValue) case "top_offset": topOffsetValue = deserialize(__dictValue, validator: ResolvedValue.topOffsetValidator).merged(with: topOffsetValue) case "underline": underlineValue = deserialize(__dictValue).merged(with: underlineValue) case parent?.actions?.link: actionsValue = actionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.alignmentVertical?.link: alignmentVerticalValue = alignmentVerticalValue.merged(with: { deserialize(__dictValue) }) case parent?.background?.link: backgroundValue = backgroundValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextRangeBackgroundTemplate.self) }) case parent?.baselineOffset?.link: baselineOffsetValue = baselineOffsetValue.merged(with: { deserialize(__dictValue) }) case parent?.border?.link: borderValue = borderValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextRangeBorderTemplate.self) }) case parent?.end?.link: endValue = endValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.endValidator) }) case parent?.fontFamily?.link: fontFamilyValue = fontFamilyValue.merged(with: { deserialize(__dictValue) }) case parent?.fontFeatureSettings?.link: fontFeatureSettingsValue = fontFeatureSettingsValue.merged(with: { deserialize(__dictValue) }) case parent?.fontSize?.link: fontSizeValue = fontSizeValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontSizeValidator) }) case parent?.fontSizeUnit?.link: fontSizeUnitValue = fontSizeUnitValue.merged(with: { deserialize(__dictValue) }) case parent?.fontVariationSettings?.link: fontVariationSettingsValue = fontVariationSettingsValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeight?.link: fontWeightValue = fontWeightValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeightValue?.link: fontWeightValueValue = fontWeightValueValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator) }) case parent?.letterSpacing?.link: letterSpacingValue = letterSpacingValue.merged(with: { deserialize(__dictValue) }) case parent?.lineHeight?.link: lineHeightValue = lineHeightValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.lineHeightValidator) }) case parent?.mask?.link: maskValue = maskValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextRangeMaskTemplate.self) }) case parent?.start?.link: startValue = startValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.startValidator) }) case parent?.strike?.link: strikeValue = strikeValue.merged(with: { deserialize(__dictValue) }) case parent?.textColor?.link: textColorValue = textColorValue.merged(with: { deserialize(__dictValue, transform: Color.color(withHexString:)) }) case parent?.textShadow?.link: textShadowValue = textShadowValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivShadowTemplate.self) }) case parent?.topOffset?.link: topOffsetValue = topOffsetValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.topOffsetValidator) }) case parent?.underline?.link: underlineValue = underlineValue.merged(with: { deserialize(__dictValue) }) default: break } } if let parent = parent { _ = actionsValue = actionsValue.merged(with: { parent.actions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = backgroundValue = backgroundValue.merged(with: { parent.background?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = borderValue = borderValue.merged(with: { parent.border?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = maskValue = maskValue.merged(with: { parent.mask?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = textShadowValue = textShadowValue.merged(with: { parent.textShadow?.resolveOptionalValue(context: context, useOnlyLinks: true) }) } let errors = mergeErrors( actionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "actions", error: $0) }, alignmentVerticalValue.errorsOrWarnings?.map { .nestedObjectError(field: "alignment_vertical", error: $0) }, backgroundValue.errorsOrWarnings?.map { .nestedObjectError(field: "background", error: $0) }, baselineOffsetValue.errorsOrWarnings?.map { .nestedObjectError(field: "baseline_offset", error: $0) }, borderValue.errorsOrWarnings?.map { .nestedObjectError(field: "border", error: $0) }, endValue.errorsOrWarnings?.map { .nestedObjectError(field: "end", error: $0) }, fontFamilyValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_family", error: $0) }, fontFeatureSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_feature_settings", error: $0) }, fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontVariationSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_variation_settings", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, letterSpacingValue.errorsOrWarnings?.map { .nestedObjectError(field: "letter_spacing", error: $0) }, lineHeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "line_height", error: $0) }, maskValue.errorsOrWarnings?.map { .nestedObjectError(field: "mask", error: $0) }, startValue.errorsOrWarnings?.map { .nestedObjectError(field: "start", error: $0) }, strikeValue.errorsOrWarnings?.map { .nestedObjectError(field: "strike", error: $0) }, textColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_color", error: $0) }, textShadowValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_shadow", error: $0) }, topOffsetValue.errorsOrWarnings?.map { .nestedObjectError(field: "top_offset", error: $0) }, underlineValue.errorsOrWarnings?.map { .nestedObjectError(field: "underline", error: $0) } ) let result = DivText.Range( actions: actionsValue.value, alignmentVertical: alignmentVerticalValue.value, background: backgroundValue.value, baselineOffset: baselineOffsetValue.value, border: borderValue.value, end: endValue.value, fontFamily: fontFamilyValue.value, fontFeatureSettings: fontFeatureSettingsValue.value, fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontVariationSettings: fontVariationSettingsValue.value, fontWeight: fontWeightValue.value, fontWeightValue: fontWeightValueValue.value, letterSpacing: letterSpacingValue.value, lineHeight: lineHeightValue.value, mask: maskValue.value, start: startValue.value, strike: strikeValue.value, textColor: textColorValue.value, textShadow: textShadowValue.value, topOffset: topOffsetValue.value, underline: underlineValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } private func mergedWithParent(templates: [TemplateName: Any]) throws -> RangeTemplate { return self } public func resolveParent(templates: [TemplateName: Any]) throws -> RangeTemplate { let merged = try mergedWithParent(templates: templates) return RangeTemplate( actions: merged.actions?.tryResolveParent(templates: templates), alignmentVertical: merged.alignmentVertical, background: merged.background?.tryResolveParent(templates: templates), baselineOffset: merged.baselineOffset, border: merged.border?.tryResolveParent(templates: templates), end: merged.end, fontFamily: merged.fontFamily, fontFeatureSettings: merged.fontFeatureSettings, fontSize: merged.fontSize, fontSizeUnit: merged.fontSizeUnit, fontVariationSettings: merged.fontVariationSettings, fontWeight: merged.fontWeight, fontWeightValue: merged.fontWeightValue, letterSpacing: merged.letterSpacing, lineHeight: merged.lineHeight, mask: merged.mask?.tryResolveParent(templates: templates), start: merged.start, strike: merged.strike, textColor: merged.textColor, textShadow: merged.textShadow?.tryResolveParent(templates: templates), topOffset: merged.topOffset, underline: merged.underline ) } } public typealias Truncate = DivText.Truncate public static let type: String = "text" public let parent: String? public let accessibility: Field? public let action: Field? public let actionAnimation: Field? // default value: DivAnimation(duration: .value(100), endValue: .value(0.6), name: .value(.fade), startValue: .value(1)) public let actions: Field<[DivActionTemplate]>? public let alignmentHorizontal: Field>? public let alignmentVertical: Field>? public let alpha: Field>? // constraint: number >= 0.0 && number <= 1.0; default value: 1.0 public let animators: Field<[DivAnimatorTemplate]>? public let autoEllipsize: Field>? public let background: Field<[DivBackgroundTemplate]>? public let border: Field? public let captureFocusOnAction: Field>? // default value: true public let columnSpan: Field>? // constraint: number >= 0 public let disappearActions: Field<[DivDisappearActionTemplate]>? public let doubletapActions: Field<[DivActionTemplate]>? public let ellipsis: Field? public let extensions: Field<[DivExtensionTemplate]>? public let focus: Field? public let focusedTextColor: Field>? public let fontFamily: Field>? public let fontFeatureSettings: Field>? public let fontSize: Field>? // constraint: number >= 0; default value: 12 public let fontSizeUnit: Field>? // default value: sp public let fontVariationSettings: Field>? public let fontWeight: Field>? public let fontWeightValue: Field>? // constraint: number > 0 public let functions: Field<[DivFunctionTemplate]>? public let height: Field? // default value: .divWrapContentSize(DivWrapContentSize()) public let hoverEndActions: Field<[DivActionTemplate]>? public let hoverStartActions: Field<[DivActionTemplate]>? public let id: Field? public let images: Field<[ImageTemplate]>? public let layoutProvider: Field? public let letterSpacing: Field>? // default value: 0 public let lineHeight: Field>? // constraint: number >= 0 public let longtapActions: Field<[DivActionTemplate]>? public let margins: Field? public let maxLines: Field>? // constraint: number >= 0 public let minHiddenLines: Field>? // constraint: number >= 0 public let paddings: Field? public let pressEndActions: Field<[DivActionTemplate]>? public let pressStartActions: Field<[DivActionTemplate]>? public let ranges: Field<[RangeTemplate]>? public let reuseId: Field>? public let rowSpan: Field>? // constraint: number >= 0 public let selectable: Field>? // default value: false public let selectedActions: Field<[DivActionTemplate]>? public let strike: Field>? // default value: none public let text: Field>? public let textAlignmentHorizontal: Field>? // default value: start public let textAlignmentVertical: Field>? // default value: top public let textColor: Field>? // default value: #FF000000 public let textGradient: Field? public let textShadow: Field? public let tightenWidth: Field>? // default value: false public let tooltips: Field<[DivTooltipTemplate]>? public let transform: Field? public let transformations: Field<[DivTransformationTemplate]>? public let transitionChange: Field? public let transitionIn: Field? public let transitionOut: Field? public let transitionTriggers: Field<[DivTransitionTrigger]>? // at least 1 elements public let truncate: Field>? // default value: end public let underline: Field>? // default value: none public let variableTriggers: Field<[DivTriggerTemplate]>? public let variables: Field<[DivVariableTemplate]>? public let visibility: Field>? // default value: visible public let visibilityAction: Field? public let visibilityActions: Field<[DivVisibilityActionTemplate]>? public let width: Field? // default value: .divMatchParentSize(DivMatchParentSize()) public convenience init(dictionary: [String: Any], templateToType: [TemplateName: String]) throws { self.init( parent: dictionary["type"] as? String, accessibility: dictionary.getOptionalField("accessibility", templateToType: templateToType), action: dictionary.getOptionalField("action", templateToType: templateToType), actionAnimation: dictionary.getOptionalField("action_animation", templateToType: templateToType), actions: dictionary.getOptionalArray("actions", templateToType: templateToType), alignmentHorizontal: dictionary.getOptionalExpressionField("alignment_horizontal"), alignmentVertical: dictionary.getOptionalExpressionField("alignment_vertical"), alpha: dictionary.getOptionalExpressionField("alpha"), animators: dictionary.getOptionalArray("animators", templateToType: templateToType), autoEllipsize: dictionary.getOptionalExpressionField("auto_ellipsize"), background: dictionary.getOptionalArray("background", templateToType: templateToType), border: dictionary.getOptionalField("border", templateToType: templateToType), captureFocusOnAction: dictionary.getOptionalExpressionField("capture_focus_on_action"), columnSpan: dictionary.getOptionalExpressionField("column_span"), disappearActions: dictionary.getOptionalArray("disappear_actions", templateToType: templateToType), doubletapActions: dictionary.getOptionalArray("doubletap_actions", templateToType: templateToType), ellipsis: dictionary.getOptionalField("ellipsis", templateToType: templateToType), extensions: dictionary.getOptionalArray("extensions", templateToType: templateToType), focus: dictionary.getOptionalField("focus", templateToType: templateToType), focusedTextColor: dictionary.getOptionalExpressionField("focused_text_color", transform: Color.color(withHexString:)), fontFamily: dictionary.getOptionalExpressionField("font_family"), fontFeatureSettings: dictionary.getOptionalExpressionField("font_feature_settings"), fontSize: dictionary.getOptionalExpressionField("font_size"), fontSizeUnit: dictionary.getOptionalExpressionField("font_size_unit"), fontVariationSettings: dictionary.getOptionalExpressionField("font_variation_settings"), fontWeight: dictionary.getOptionalExpressionField("font_weight"), fontWeightValue: dictionary.getOptionalExpressionField("font_weight_value"), functions: dictionary.getOptionalArray("functions", templateToType: templateToType), height: dictionary.getOptionalField("height", templateToType: templateToType), hoverEndActions: dictionary.getOptionalArray("hover_end_actions", templateToType: templateToType), hoverStartActions: dictionary.getOptionalArray("hover_start_actions", templateToType: templateToType), id: dictionary.getOptionalField("id"), images: dictionary.getOptionalArray("images", templateToType: templateToType), layoutProvider: dictionary.getOptionalField("layout_provider", templateToType: templateToType), letterSpacing: dictionary.getOptionalExpressionField("letter_spacing"), lineHeight: dictionary.getOptionalExpressionField("line_height"), longtapActions: dictionary.getOptionalArray("longtap_actions", templateToType: templateToType), margins: dictionary.getOptionalField("margins", templateToType: templateToType), maxLines: dictionary.getOptionalExpressionField("max_lines"), minHiddenLines: dictionary.getOptionalExpressionField("min_hidden_lines"), paddings: dictionary.getOptionalField("paddings", templateToType: templateToType), pressEndActions: dictionary.getOptionalArray("press_end_actions", templateToType: templateToType), pressStartActions: dictionary.getOptionalArray("press_start_actions", templateToType: templateToType), ranges: dictionary.getOptionalArray("ranges", templateToType: templateToType), reuseId: dictionary.getOptionalExpressionField("reuse_id"), rowSpan: dictionary.getOptionalExpressionField("row_span"), selectable: dictionary.getOptionalExpressionField("selectable"), selectedActions: dictionary.getOptionalArray("selected_actions", templateToType: templateToType), strike: dictionary.getOptionalExpressionField("strike"), text: dictionary.getOptionalExpressionField("text"), textAlignmentHorizontal: dictionary.getOptionalExpressionField("text_alignment_horizontal"), textAlignmentVertical: dictionary.getOptionalExpressionField("text_alignment_vertical"), textColor: dictionary.getOptionalExpressionField("text_color", transform: Color.color(withHexString:)), textGradient: dictionary.getOptionalField("text_gradient", templateToType: templateToType), textShadow: dictionary.getOptionalField("text_shadow", templateToType: templateToType), tightenWidth: dictionary.getOptionalExpressionField("tighten_width"), tooltips: dictionary.getOptionalArray("tooltips", templateToType: templateToType), transform: dictionary.getOptionalField("transform", templateToType: templateToType), transformations: dictionary.getOptionalArray("transformations", templateToType: templateToType), transitionChange: dictionary.getOptionalField("transition_change", templateToType: templateToType), transitionIn: dictionary.getOptionalField("transition_in", templateToType: templateToType), transitionOut: dictionary.getOptionalField("transition_out", templateToType: templateToType), transitionTriggers: dictionary.getOptionalArray("transition_triggers"), truncate: dictionary.getOptionalExpressionField("truncate"), underline: dictionary.getOptionalExpressionField("underline"), variableTriggers: dictionary.getOptionalArray("variable_triggers", templateToType: templateToType), variables: dictionary.getOptionalArray("variables", templateToType: templateToType), visibility: dictionary.getOptionalExpressionField("visibility"), visibilityAction: dictionary.getOptionalField("visibility_action", templateToType: templateToType), visibilityActions: dictionary.getOptionalArray("visibility_actions", templateToType: templateToType), width: dictionary.getOptionalField("width", templateToType: templateToType) ) } init( parent: String?, accessibility: Field? = nil, action: Field? = nil, actionAnimation: Field? = nil, actions: Field<[DivActionTemplate]>? = nil, alignmentHorizontal: Field>? = nil, alignmentVertical: Field>? = nil, alpha: Field>? = nil, animators: Field<[DivAnimatorTemplate]>? = nil, autoEllipsize: Field>? = nil, background: Field<[DivBackgroundTemplate]>? = nil, border: Field? = nil, captureFocusOnAction: Field>? = nil, columnSpan: Field>? = nil, disappearActions: Field<[DivDisappearActionTemplate]>? = nil, doubletapActions: Field<[DivActionTemplate]>? = nil, ellipsis: Field? = nil, extensions: Field<[DivExtensionTemplate]>? = nil, focus: Field? = nil, focusedTextColor: Field>? = nil, fontFamily: Field>? = nil, fontFeatureSettings: Field>? = nil, fontSize: Field>? = nil, fontSizeUnit: Field>? = nil, fontVariationSettings: Field>? = nil, fontWeight: Field>? = nil, fontWeightValue: Field>? = nil, functions: Field<[DivFunctionTemplate]>? = nil, height: Field? = nil, hoverEndActions: Field<[DivActionTemplate]>? = nil, hoverStartActions: Field<[DivActionTemplate]>? = nil, id: Field? = nil, images: Field<[ImageTemplate]>? = nil, layoutProvider: Field? = nil, letterSpacing: Field>? = nil, lineHeight: Field>? = nil, longtapActions: Field<[DivActionTemplate]>? = nil, margins: Field? = nil, maxLines: Field>? = nil, minHiddenLines: Field>? = nil, paddings: Field? = nil, pressEndActions: Field<[DivActionTemplate]>? = nil, pressStartActions: Field<[DivActionTemplate]>? = nil, ranges: Field<[RangeTemplate]>? = nil, reuseId: Field>? = nil, rowSpan: Field>? = nil, selectable: Field>? = nil, selectedActions: Field<[DivActionTemplate]>? = nil, strike: Field>? = nil, text: Field>? = nil, textAlignmentHorizontal: Field>? = nil, textAlignmentVertical: Field>? = nil, textColor: Field>? = nil, textGradient: Field? = nil, textShadow: Field? = nil, tightenWidth: Field>? = nil, tooltips: Field<[DivTooltipTemplate]>? = nil, transform: Field? = nil, transformations: Field<[DivTransformationTemplate]>? = nil, transitionChange: Field? = nil, transitionIn: Field? = nil, transitionOut: Field? = nil, transitionTriggers: Field<[DivTransitionTrigger]>? = nil, truncate: Field>? = nil, underline: Field>? = nil, variableTriggers: Field<[DivTriggerTemplate]>? = nil, variables: Field<[DivVariableTemplate]>? = nil, visibility: Field>? = nil, visibilityAction: Field? = nil, visibilityActions: Field<[DivVisibilityActionTemplate]>? = nil, width: Field? = nil ) { self.parent = parent self.accessibility = accessibility self.action = action self.actionAnimation = actionAnimation self.actions = actions self.alignmentHorizontal = alignmentHorizontal self.alignmentVertical = alignmentVertical self.alpha = alpha self.animators = animators self.autoEllipsize = autoEllipsize self.background = background self.border = border self.captureFocusOnAction = captureFocusOnAction self.columnSpan = columnSpan self.disappearActions = disappearActions self.doubletapActions = doubletapActions self.ellipsis = ellipsis self.extensions = extensions self.focus = focus self.focusedTextColor = focusedTextColor self.fontFamily = fontFamily self.fontFeatureSettings = fontFeatureSettings self.fontSize = fontSize self.fontSizeUnit = fontSizeUnit self.fontVariationSettings = fontVariationSettings self.fontWeight = fontWeight self.fontWeightValue = fontWeightValue self.functions = functions self.height = height self.hoverEndActions = hoverEndActions self.hoverStartActions = hoverStartActions self.id = id self.images = images self.layoutProvider = layoutProvider self.letterSpacing = letterSpacing self.lineHeight = lineHeight self.longtapActions = longtapActions self.margins = margins self.maxLines = maxLines self.minHiddenLines = minHiddenLines self.paddings = paddings self.pressEndActions = pressEndActions self.pressStartActions = pressStartActions self.ranges = ranges self.reuseId = reuseId self.rowSpan = rowSpan self.selectable = selectable self.selectedActions = selectedActions self.strike = strike self.text = text self.textAlignmentHorizontal = textAlignmentHorizontal self.textAlignmentVertical = textAlignmentVertical self.textColor = textColor self.textGradient = textGradient self.textShadow = textShadow self.tightenWidth = tightenWidth self.tooltips = tooltips self.transform = transform self.transformations = transformations self.transitionChange = transitionChange self.transitionIn = transitionIn self.transitionOut = transitionOut self.transitionTriggers = transitionTriggers self.truncate = truncate self.underline = underline self.variableTriggers = variableTriggers self.variables = variables self.visibility = visibility self.visibilityAction = visibilityAction self.visibilityActions = visibilityActions self.width = width } private static func resolveOnlyLinks(context: TemplatesContext, parent: DivTextTemplate?) -> DeserializationResult { let accessibilityValue = parent?.accessibility?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let actionValue = parent?.action?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let actionAnimationValue = parent?.actionAnimation?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let actionsValue = parent?.actions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let alignmentHorizontalValue = parent?.alignmentHorizontal?.resolveOptionalValue(context: context) ?? .noValue let alignmentVerticalValue = parent?.alignmentVertical?.resolveOptionalValue(context: context) ?? .noValue let alphaValue = parent?.alpha?.resolveOptionalValue(context: context, validator: ResolvedValue.alphaValidator) ?? .noValue let animatorsValue = parent?.animators?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let autoEllipsizeValue = parent?.autoEllipsize?.resolveOptionalValue(context: context) ?? .noValue let backgroundValue = parent?.background?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let borderValue = parent?.border?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let captureFocusOnActionValue = parent?.captureFocusOnAction?.resolveOptionalValue(context: context) ?? .noValue let columnSpanValue = parent?.columnSpan?.resolveOptionalValue(context: context, validator: ResolvedValue.columnSpanValidator) ?? .noValue let disappearActionsValue = parent?.disappearActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let doubletapActionsValue = parent?.doubletapActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let ellipsisValue = parent?.ellipsis?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let extensionsValue = parent?.extensions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let focusValue = parent?.focus?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let focusedTextColorValue = parent?.focusedTextColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue let fontFamilyValue = parent?.fontFamily?.resolveOptionalValue(context: context) ?? .noValue let fontFeatureSettingsValue = parent?.fontFeatureSettings?.resolveOptionalValue(context: context) ?? .noValue let fontSizeValue = parent?.fontSize?.resolveOptionalValue(context: context, validator: ResolvedValue.fontSizeValidator) ?? .noValue let fontSizeUnitValue = parent?.fontSizeUnit?.resolveOptionalValue(context: context) ?? .noValue let fontVariationSettingsValue = parent?.fontVariationSettings?.resolveOptionalValue(context: context) ?? .noValue let fontWeightValue = parent?.fontWeight?.resolveOptionalValue(context: context) ?? .noValue let fontWeightValueValue = parent?.fontWeightValue?.resolveOptionalValue(context: context, validator: ResolvedValue.fontWeightValueValidator) ?? .noValue let functionsValue = parent?.functions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let heightValue = parent?.height?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let hoverEndActionsValue = parent?.hoverEndActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let hoverStartActionsValue = parent?.hoverStartActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let idValue = parent?.id?.resolveOptionalValue(context: context) ?? .noValue let imagesValue = parent?.images?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let layoutProviderValue = parent?.layoutProvider?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let letterSpacingValue = parent?.letterSpacing?.resolveOptionalValue(context: context) ?? .noValue let lineHeightValue = parent?.lineHeight?.resolveOptionalValue(context: context, validator: ResolvedValue.lineHeightValidator) ?? .noValue let longtapActionsValue = parent?.longtapActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let marginsValue = parent?.margins?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let maxLinesValue = parent?.maxLines?.resolveOptionalValue(context: context, validator: ResolvedValue.maxLinesValidator) ?? .noValue let minHiddenLinesValue = parent?.minHiddenLines?.resolveOptionalValue(context: context, validator: ResolvedValue.minHiddenLinesValidator) ?? .noValue let paddingsValue = parent?.paddings?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let pressEndActionsValue = parent?.pressEndActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let pressStartActionsValue = parent?.pressStartActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let rangesValue = parent?.ranges?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let reuseIdValue = parent?.reuseId?.resolveOptionalValue(context: context) ?? .noValue let rowSpanValue = parent?.rowSpan?.resolveOptionalValue(context: context, validator: ResolvedValue.rowSpanValidator) ?? .noValue let selectableValue = parent?.selectable?.resolveOptionalValue(context: context) ?? .noValue let selectedActionsValue = parent?.selectedActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let strikeValue = parent?.strike?.resolveOptionalValue(context: context) ?? .noValue let textValue = parent?.text?.resolveValue(context: context) ?? .noValue let textAlignmentHorizontalValue = parent?.textAlignmentHorizontal?.resolveOptionalValue(context: context) ?? .noValue let textAlignmentVerticalValue = parent?.textAlignmentVertical?.resolveOptionalValue(context: context) ?? .noValue let textColorValue = parent?.textColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:)) ?? .noValue let textGradientValue = parent?.textGradient?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let textShadowValue = parent?.textShadow?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let tightenWidthValue = parent?.tightenWidth?.resolveOptionalValue(context: context) ?? .noValue let tooltipsValue = parent?.tooltips?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let transformValue = parent?.transform?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let transformationsValue = parent?.transformations?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let transitionChangeValue = parent?.transitionChange?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let transitionInValue = parent?.transitionIn?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let transitionOutValue = parent?.transitionOut?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let transitionTriggersValue = parent?.transitionTriggers?.resolveOptionalValue(context: context, validator: ResolvedValue.transitionTriggersValidator) ?? .noValue let truncateValue = parent?.truncate?.resolveOptionalValue(context: context) ?? .noValue let underlineValue = parent?.underline?.resolveOptionalValue(context: context) ?? .noValue let variableTriggersValue = parent?.variableTriggers?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let variablesValue = parent?.variables?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let visibilityValue = parent?.visibility?.resolveOptionalValue(context: context) ?? .noValue let visibilityActionValue = parent?.visibilityAction?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let visibilityActionsValue = parent?.visibilityActions?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue let widthValue = parent?.width?.resolveOptionalValue(context: context, useOnlyLinks: true) ?? .noValue var errors = mergeErrors( accessibilityValue.errorsOrWarnings?.map { .nestedObjectError(field: "accessibility", error: $0) }, actionValue.errorsOrWarnings?.map { .nestedObjectError(field: "action", error: $0) }, actionAnimationValue.errorsOrWarnings?.map { .nestedObjectError(field: "action_animation", error: $0) }, actionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "actions", error: $0) }, alignmentHorizontalValue.errorsOrWarnings?.map { .nestedObjectError(field: "alignment_horizontal", error: $0) }, alignmentVerticalValue.errorsOrWarnings?.map { .nestedObjectError(field: "alignment_vertical", error: $0) }, alphaValue.errorsOrWarnings?.map { .nestedObjectError(field: "alpha", error: $0) }, animatorsValue.errorsOrWarnings?.map { .nestedObjectError(field: "animators", error: $0) }, autoEllipsizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "auto_ellipsize", error: $0) }, backgroundValue.errorsOrWarnings?.map { .nestedObjectError(field: "background", error: $0) }, borderValue.errorsOrWarnings?.map { .nestedObjectError(field: "border", error: $0) }, captureFocusOnActionValue.errorsOrWarnings?.map { .nestedObjectError(field: "capture_focus_on_action", error: $0) }, columnSpanValue.errorsOrWarnings?.map { .nestedObjectError(field: "column_span", error: $0) }, disappearActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "disappear_actions", error: $0) }, doubletapActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "doubletap_actions", error: $0) }, ellipsisValue.errorsOrWarnings?.map { .nestedObjectError(field: "ellipsis", error: $0) }, extensionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "extensions", error: $0) }, focusValue.errorsOrWarnings?.map { .nestedObjectError(field: "focus", error: $0) }, focusedTextColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "focused_text_color", error: $0) }, fontFamilyValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_family", error: $0) }, fontFeatureSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_feature_settings", error: $0) }, fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontVariationSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_variation_settings", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, functionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "functions", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, hoverEndActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "hover_end_actions", error: $0) }, hoverStartActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "hover_start_actions", error: $0) }, idValue.errorsOrWarnings?.map { .nestedObjectError(field: "id", error: $0) }, imagesValue.errorsOrWarnings?.map { .nestedObjectError(field: "images", error: $0) }, layoutProviderValue.errorsOrWarnings?.map { .nestedObjectError(field: "layout_provider", error: $0) }, letterSpacingValue.errorsOrWarnings?.map { .nestedObjectError(field: "letter_spacing", error: $0) }, lineHeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "line_height", error: $0) }, longtapActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "longtap_actions", error: $0) }, marginsValue.errorsOrWarnings?.map { .nestedObjectError(field: "margins", error: $0) }, maxLinesValue.errorsOrWarnings?.map { .nestedObjectError(field: "max_lines", error: $0) }, minHiddenLinesValue.errorsOrWarnings?.map { .nestedObjectError(field: "min_hidden_lines", error: $0) }, paddingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "paddings", error: $0) }, pressEndActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "press_end_actions", error: $0) }, pressStartActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "press_start_actions", error: $0) }, rangesValue.errorsOrWarnings?.map { .nestedObjectError(field: "ranges", error: $0) }, reuseIdValue.errorsOrWarnings?.map { .nestedObjectError(field: "reuse_id", error: $0) }, rowSpanValue.errorsOrWarnings?.map { .nestedObjectError(field: "row_span", error: $0) }, selectableValue.errorsOrWarnings?.map { .nestedObjectError(field: "selectable", error: $0) }, selectedActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "selected_actions", error: $0) }, strikeValue.errorsOrWarnings?.map { .nestedObjectError(field: "strike", error: $0) }, textValue.errorsOrWarnings?.map { .nestedObjectError(field: "text", error: $0) }, textAlignmentHorizontalValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_alignment_horizontal", error: $0) }, textAlignmentVerticalValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_alignment_vertical", error: $0) }, textColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_color", error: $0) }, textGradientValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_gradient", error: $0) }, textShadowValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_shadow", error: $0) }, tightenWidthValue.errorsOrWarnings?.map { .nestedObjectError(field: "tighten_width", error: $0) }, tooltipsValue.errorsOrWarnings?.map { .nestedObjectError(field: "tooltips", error: $0) }, transformValue.errorsOrWarnings?.map { .nestedObjectError(field: "transform", error: $0) }, transformationsValue.errorsOrWarnings?.map { .nestedObjectError(field: "transformations", error: $0) }, transitionChangeValue.errorsOrWarnings?.map { .nestedObjectError(field: "transition_change", error: $0) }, transitionInValue.errorsOrWarnings?.map { .nestedObjectError(field: "transition_in", error: $0) }, transitionOutValue.errorsOrWarnings?.map { .nestedObjectError(field: "transition_out", error: $0) }, transitionTriggersValue.errorsOrWarnings?.map { .nestedObjectError(field: "transition_triggers", error: $0) }, truncateValue.errorsOrWarnings?.map { .nestedObjectError(field: "truncate", error: $0) }, underlineValue.errorsOrWarnings?.map { .nestedObjectError(field: "underline", error: $0) }, variableTriggersValue.errorsOrWarnings?.map { .nestedObjectError(field: "variable_triggers", error: $0) }, variablesValue.errorsOrWarnings?.map { .nestedObjectError(field: "variables", error: $0) }, visibilityValue.errorsOrWarnings?.map { .nestedObjectError(field: "visibility", error: $0) }, visibilityActionValue.errorsOrWarnings?.map { .nestedObjectError(field: "visibility_action", error: $0) }, visibilityActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "visibility_actions", error: $0) }, widthValue.errorsOrWarnings?.map { .nestedObjectError(field: "width", error: $0) } ) if case .noValue = textValue { errors.append(.requiredFieldIsMissing(field: "text")) } guard let textNonNil = textValue.value else { return .failure(NonEmptyArray(errors)!) } let result = DivText( accessibility: accessibilityValue.value, action: actionValue.value, actionAnimation: actionAnimationValue.value, actions: actionsValue.value, alignmentHorizontal: alignmentHorizontalValue.value, alignmentVertical: alignmentVerticalValue.value, alpha: alphaValue.value, animators: animatorsValue.value, autoEllipsize: autoEllipsizeValue.value, background: backgroundValue.value, border: borderValue.value, captureFocusOnAction: captureFocusOnActionValue.value, columnSpan: columnSpanValue.value, disappearActions: disappearActionsValue.value, doubletapActions: doubletapActionsValue.value, ellipsis: ellipsisValue.value, extensions: extensionsValue.value, focus: focusValue.value, focusedTextColor: focusedTextColorValue.value, fontFamily: fontFamilyValue.value, fontFeatureSettings: fontFeatureSettingsValue.value, fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontVariationSettings: fontVariationSettingsValue.value, fontWeight: fontWeightValue.value, fontWeightValue: fontWeightValueValue.value, functions: functionsValue.value, height: heightValue.value, hoverEndActions: hoverEndActionsValue.value, hoverStartActions: hoverStartActionsValue.value, id: idValue.value, images: imagesValue.value, layoutProvider: layoutProviderValue.value, letterSpacing: letterSpacingValue.value, lineHeight: lineHeightValue.value, longtapActions: longtapActionsValue.value, margins: marginsValue.value, maxLines: maxLinesValue.value, minHiddenLines: minHiddenLinesValue.value, paddings: paddingsValue.value, pressEndActions: pressEndActionsValue.value, pressStartActions: pressStartActionsValue.value, ranges: rangesValue.value, reuseId: reuseIdValue.value, rowSpan: rowSpanValue.value, selectable: selectableValue.value, selectedActions: selectedActionsValue.value, strike: strikeValue.value, text: textNonNil, textAlignmentHorizontal: textAlignmentHorizontalValue.value, textAlignmentVertical: textAlignmentVerticalValue.value, textColor: textColorValue.value, textGradient: textGradientValue.value, textShadow: textShadowValue.value, tightenWidth: tightenWidthValue.value, tooltips: tooltipsValue.value, transform: transformValue.value, transformations: transformationsValue.value, transitionChange: transitionChangeValue.value, transitionIn: transitionInValue.value, transitionOut: transitionOutValue.value, transitionTriggers: transitionTriggersValue.value, truncate: truncateValue.value, underline: underlineValue.value, variableTriggers: variableTriggersValue.value, variables: variablesValue.value, visibility: visibilityValue.value, visibilityAction: visibilityActionValue.value, visibilityActions: visibilityActionsValue.value, width: widthValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } public static func resolveValue(context: TemplatesContext, parent: DivTextTemplate?, useOnlyLinks: Bool) -> DeserializationResult { if useOnlyLinks { return resolveOnlyLinks(context: context, parent: parent) } var accessibilityValue: DeserializationResult = .noValue var actionValue: DeserializationResult = .noValue var actionAnimationValue: DeserializationResult = .noValue var actionsValue: DeserializationResult<[DivAction]> = .noValue var alignmentHorizontalValue: DeserializationResult> = parent?.alignmentHorizontal?.value() ?? .noValue var alignmentVerticalValue: DeserializationResult> = parent?.alignmentVertical?.value() ?? .noValue var alphaValue: DeserializationResult> = parent?.alpha?.value() ?? .noValue var animatorsValue: DeserializationResult<[DivAnimator]> = .noValue var autoEllipsizeValue: DeserializationResult> = parent?.autoEllipsize?.value() ?? .noValue var backgroundValue: DeserializationResult<[DivBackground]> = .noValue var borderValue: DeserializationResult = .noValue var captureFocusOnActionValue: DeserializationResult> = parent?.captureFocusOnAction?.value() ?? .noValue var columnSpanValue: DeserializationResult> = parent?.columnSpan?.value() ?? .noValue var disappearActionsValue: DeserializationResult<[DivDisappearAction]> = .noValue var doubletapActionsValue: DeserializationResult<[DivAction]> = .noValue var ellipsisValue: DeserializationResult = .noValue var extensionsValue: DeserializationResult<[DivExtension]> = .noValue var focusValue: DeserializationResult = .noValue var focusedTextColorValue: DeserializationResult> = parent?.focusedTextColor?.value() ?? .noValue var fontFamilyValue: DeserializationResult> = parent?.fontFamily?.value() ?? .noValue var fontFeatureSettingsValue: DeserializationResult> = parent?.fontFeatureSettings?.value() ?? .noValue var fontSizeValue: DeserializationResult> = parent?.fontSize?.value() ?? .noValue var fontSizeUnitValue: DeserializationResult> = parent?.fontSizeUnit?.value() ?? .noValue var fontVariationSettingsValue: DeserializationResult> = parent?.fontVariationSettings?.value() ?? .noValue var fontWeightValue: DeserializationResult> = parent?.fontWeight?.value() ?? .noValue var fontWeightValueValue: DeserializationResult> = parent?.fontWeightValue?.value() ?? .noValue var functionsValue: DeserializationResult<[DivFunction]> = .noValue var heightValue: DeserializationResult = .noValue var hoverEndActionsValue: DeserializationResult<[DivAction]> = .noValue var hoverStartActionsValue: DeserializationResult<[DivAction]> = .noValue var idValue: DeserializationResult = parent?.id?.value() ?? .noValue var imagesValue: DeserializationResult<[DivText.Image]> = .noValue var layoutProviderValue: DeserializationResult = .noValue var letterSpacingValue: DeserializationResult> = parent?.letterSpacing?.value() ?? .noValue var lineHeightValue: DeserializationResult> = parent?.lineHeight?.value() ?? .noValue var longtapActionsValue: DeserializationResult<[DivAction]> = .noValue var marginsValue: DeserializationResult = .noValue var maxLinesValue: DeserializationResult> = parent?.maxLines?.value() ?? .noValue var minHiddenLinesValue: DeserializationResult> = parent?.minHiddenLines?.value() ?? .noValue var paddingsValue: DeserializationResult = .noValue var pressEndActionsValue: DeserializationResult<[DivAction]> = .noValue var pressStartActionsValue: DeserializationResult<[DivAction]> = .noValue var rangesValue: DeserializationResult<[DivText.Range]> = .noValue var reuseIdValue: DeserializationResult> = parent?.reuseId?.value() ?? .noValue var rowSpanValue: DeserializationResult> = parent?.rowSpan?.value() ?? .noValue var selectableValue: DeserializationResult> = parent?.selectable?.value() ?? .noValue var selectedActionsValue: DeserializationResult<[DivAction]> = .noValue var strikeValue: DeserializationResult> = parent?.strike?.value() ?? .noValue var textValue: DeserializationResult> = parent?.text?.value() ?? .noValue var textAlignmentHorizontalValue: DeserializationResult> = parent?.textAlignmentHorizontal?.value() ?? .noValue var textAlignmentVerticalValue: DeserializationResult> = parent?.textAlignmentVertical?.value() ?? .noValue var textColorValue: DeserializationResult> = parent?.textColor?.value() ?? .noValue var textGradientValue: DeserializationResult = .noValue var textShadowValue: DeserializationResult = .noValue var tightenWidthValue: DeserializationResult> = parent?.tightenWidth?.value() ?? .noValue var tooltipsValue: DeserializationResult<[DivTooltip]> = .noValue var transformValue: DeserializationResult = .noValue var transformationsValue: DeserializationResult<[DivTransformation]> = .noValue var transitionChangeValue: DeserializationResult = .noValue var transitionInValue: DeserializationResult = .noValue var transitionOutValue: DeserializationResult = .noValue var transitionTriggersValue: DeserializationResult<[DivTransitionTrigger]> = parent?.transitionTriggers?.value(validatedBy: ResolvedValue.transitionTriggersValidator) ?? .noValue var truncateValue: DeserializationResult> = parent?.truncate?.value() ?? .noValue var underlineValue: DeserializationResult> = parent?.underline?.value() ?? .noValue var variableTriggersValue: DeserializationResult<[DivTrigger]> = .noValue var variablesValue: DeserializationResult<[DivVariable]> = .noValue var visibilityValue: DeserializationResult> = parent?.visibility?.value() ?? .noValue var visibilityActionValue: DeserializationResult = .noValue var visibilityActionsValue: DeserializationResult<[DivVisibilityAction]> = .noValue var widthValue: DeserializationResult = .noValue context.templateData.forEach { key, __dictValue in switch key { case "accessibility": accessibilityValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAccessibilityTemplate.self).merged(with: accessibilityValue) case "action": actionValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: actionValue) case "action_animation": actionAnimationValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAnimationTemplate.self).merged(with: actionAnimationValue) case "actions": actionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: actionsValue) case "alignment_horizontal": alignmentHorizontalValue = deserialize(__dictValue).merged(with: alignmentHorizontalValue) case "alignment_vertical": alignmentVerticalValue = deserialize(__dictValue).merged(with: alignmentVerticalValue) case "alpha": alphaValue = deserialize(__dictValue, validator: ResolvedValue.alphaValidator).merged(with: alphaValue) case "animators": animatorsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAnimatorTemplate.self).merged(with: animatorsValue) case "auto_ellipsize": autoEllipsizeValue = deserialize(__dictValue).merged(with: autoEllipsizeValue) case "background": backgroundValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivBackgroundTemplate.self).merged(with: backgroundValue) case "border": borderValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivBorderTemplate.self).merged(with: borderValue) case "capture_focus_on_action": captureFocusOnActionValue = deserialize(__dictValue).merged(with: captureFocusOnActionValue) case "column_span": columnSpanValue = deserialize(__dictValue, validator: ResolvedValue.columnSpanValidator).merged(with: columnSpanValue) case "disappear_actions": disappearActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivDisappearActionTemplate.self).merged(with: disappearActionsValue) case "doubletap_actions": doubletapActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: doubletapActionsValue) case "ellipsis": ellipsisValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.EllipsisTemplate.self).merged(with: ellipsisValue) case "extensions": extensionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivExtensionTemplate.self).merged(with: extensionsValue) case "focus": focusValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivFocusTemplate.self).merged(with: focusValue) case "focused_text_color": focusedTextColorValue = deserialize(__dictValue, transform: Color.color(withHexString:)).merged(with: focusedTextColorValue) case "font_family": fontFamilyValue = deserialize(__dictValue).merged(with: fontFamilyValue) case "font_feature_settings": fontFeatureSettingsValue = deserialize(__dictValue).merged(with: fontFeatureSettingsValue) case "font_size": fontSizeValue = deserialize(__dictValue, validator: ResolvedValue.fontSizeValidator).merged(with: fontSizeValue) case "font_size_unit": fontSizeUnitValue = deserialize(__dictValue).merged(with: fontSizeUnitValue) case "font_variation_settings": fontVariationSettingsValue = deserialize(__dictValue).merged(with: fontVariationSettingsValue) case "font_weight": fontWeightValue = deserialize(__dictValue).merged(with: fontWeightValue) case "font_weight_value": fontWeightValueValue = deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator).merged(with: fontWeightValueValue) case "functions": functionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivFunctionTemplate.self).merged(with: functionsValue) case "height": heightValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self).merged(with: heightValue) case "hover_end_actions": hoverEndActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: hoverEndActionsValue) case "hover_start_actions": hoverStartActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: hoverStartActionsValue) case "id": idValue = deserialize(__dictValue).merged(with: idValue) case "images": imagesValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.ImageTemplate.self).merged(with: imagesValue) case "layout_provider": layoutProviderValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivLayoutProviderTemplate.self).merged(with: layoutProviderValue) case "letter_spacing": letterSpacingValue = deserialize(__dictValue).merged(with: letterSpacingValue) case "line_height": lineHeightValue = deserialize(__dictValue, validator: ResolvedValue.lineHeightValidator).merged(with: lineHeightValue) case "longtap_actions": longtapActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: longtapActionsValue) case "margins": marginsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivEdgeInsetsTemplate.self).merged(with: marginsValue) case "max_lines": maxLinesValue = deserialize(__dictValue, validator: ResolvedValue.maxLinesValidator).merged(with: maxLinesValue) case "min_hidden_lines": minHiddenLinesValue = deserialize(__dictValue, validator: ResolvedValue.minHiddenLinesValidator).merged(with: minHiddenLinesValue) case "paddings": paddingsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivEdgeInsetsTemplate.self).merged(with: paddingsValue) case "press_end_actions": pressEndActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: pressEndActionsValue) case "press_start_actions": pressStartActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: pressStartActionsValue) case "ranges": rangesValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.RangeTemplate.self).merged(with: rangesValue) case "reuse_id": reuseIdValue = deserialize(__dictValue).merged(with: reuseIdValue) case "row_span": rowSpanValue = deserialize(__dictValue, validator: ResolvedValue.rowSpanValidator).merged(with: rowSpanValue) case "selectable": selectableValue = deserialize(__dictValue).merged(with: selectableValue) case "selected_actions": selectedActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self).merged(with: selectedActionsValue) case "strike": strikeValue = deserialize(__dictValue).merged(with: strikeValue) case "text": textValue = deserialize(__dictValue).merged(with: textValue) case "text_alignment_horizontal": textAlignmentHorizontalValue = deserialize(__dictValue).merged(with: textAlignmentHorizontalValue) case "text_alignment_vertical": textAlignmentVerticalValue = deserialize(__dictValue).merged(with: textAlignmentVerticalValue) case "text_color": textColorValue = deserialize(__dictValue, transform: Color.color(withHexString:)).merged(with: textColorValue) case "text_gradient": textGradientValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextGradientTemplate.self).merged(with: textGradientValue) case "text_shadow": textShadowValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivShadowTemplate.self).merged(with: textShadowValue) case "tighten_width": tightenWidthValue = deserialize(__dictValue).merged(with: tightenWidthValue) case "tooltips": tooltipsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTooltipTemplate.self).merged(with: tooltipsValue) case "transform": transformValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTransformTemplate.self).merged(with: transformValue) case "transformations": transformationsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTransformationTemplate.self).merged(with: transformationsValue) case "transition_change": transitionChangeValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivChangeTransitionTemplate.self).merged(with: transitionChangeValue) case "transition_in": transitionInValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAppearanceTransitionTemplate.self).merged(with: transitionInValue) case "transition_out": transitionOutValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAppearanceTransitionTemplate.self).merged(with: transitionOutValue) case "transition_triggers": transitionTriggersValue = deserialize(__dictValue, validator: ResolvedValue.transitionTriggersValidator).merged(with: transitionTriggersValue) case "truncate": truncateValue = deserialize(__dictValue).merged(with: truncateValue) case "underline": underlineValue = deserialize(__dictValue).merged(with: underlineValue) case "variable_triggers": variableTriggersValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTriggerTemplate.self).merged(with: variableTriggersValue) case "variables": variablesValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivVariableTemplate.self).merged(with: variablesValue) case "visibility": visibilityValue = deserialize(__dictValue).merged(with: visibilityValue) case "visibility_action": visibilityActionValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivVisibilityActionTemplate.self).merged(with: visibilityActionValue) case "visibility_actions": visibilityActionsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivVisibilityActionTemplate.self).merged(with: visibilityActionsValue) case "width": widthValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self).merged(with: widthValue) case parent?.accessibility?.link: accessibilityValue = accessibilityValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAccessibilityTemplate.self) }) case parent?.action?.link: actionValue = actionValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.actionAnimation?.link: actionAnimationValue = actionAnimationValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAnimationTemplate.self) }) case parent?.actions?.link: actionsValue = actionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.alignmentHorizontal?.link: alignmentHorizontalValue = alignmentHorizontalValue.merged(with: { deserialize(__dictValue) }) case parent?.alignmentVertical?.link: alignmentVerticalValue = alignmentVerticalValue.merged(with: { deserialize(__dictValue) }) case parent?.alpha?.link: alphaValue = alphaValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.alphaValidator) }) case parent?.animators?.link: animatorsValue = animatorsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAnimatorTemplate.self) }) case parent?.autoEllipsize?.link: autoEllipsizeValue = autoEllipsizeValue.merged(with: { deserialize(__dictValue) }) case parent?.background?.link: backgroundValue = backgroundValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivBackgroundTemplate.self) }) case parent?.border?.link: borderValue = borderValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivBorderTemplate.self) }) case parent?.captureFocusOnAction?.link: captureFocusOnActionValue = captureFocusOnActionValue.merged(with: { deserialize(__dictValue) }) case parent?.columnSpan?.link: columnSpanValue = columnSpanValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.columnSpanValidator) }) case parent?.disappearActions?.link: disappearActionsValue = disappearActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivDisappearActionTemplate.self) }) case parent?.doubletapActions?.link: doubletapActionsValue = doubletapActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.ellipsis?.link: ellipsisValue = ellipsisValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.EllipsisTemplate.self) }) case parent?.extensions?.link: extensionsValue = extensionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivExtensionTemplate.self) }) case parent?.focus?.link: focusValue = focusValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivFocusTemplate.self) }) case parent?.focusedTextColor?.link: focusedTextColorValue = focusedTextColorValue.merged(with: { deserialize(__dictValue, transform: Color.color(withHexString:)) }) case parent?.fontFamily?.link: fontFamilyValue = fontFamilyValue.merged(with: { deserialize(__dictValue) }) case parent?.fontFeatureSettings?.link: fontFeatureSettingsValue = fontFeatureSettingsValue.merged(with: { deserialize(__dictValue) }) case parent?.fontSize?.link: fontSizeValue = fontSizeValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontSizeValidator) }) case parent?.fontSizeUnit?.link: fontSizeUnitValue = fontSizeUnitValue.merged(with: { deserialize(__dictValue) }) case parent?.fontVariationSettings?.link: fontVariationSettingsValue = fontVariationSettingsValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeight?.link: fontWeightValue = fontWeightValue.merged(with: { deserialize(__dictValue) }) case parent?.fontWeightValue?.link: fontWeightValueValue = fontWeightValueValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.fontWeightValueValidator) }) case parent?.functions?.link: functionsValue = functionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivFunctionTemplate.self) }) case parent?.height?.link: heightValue = heightValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self) }) case parent?.hoverEndActions?.link: hoverEndActionsValue = hoverEndActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.hoverStartActions?.link: hoverStartActionsValue = hoverStartActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.id?.link: idValue = idValue.merged(with: { deserialize(__dictValue) }) case parent?.images?.link: imagesValue = imagesValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.ImageTemplate.self) }) case parent?.layoutProvider?.link: layoutProviderValue = layoutProviderValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivLayoutProviderTemplate.self) }) case parent?.letterSpacing?.link: letterSpacingValue = letterSpacingValue.merged(with: { deserialize(__dictValue) }) case parent?.lineHeight?.link: lineHeightValue = lineHeightValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.lineHeightValidator) }) case parent?.longtapActions?.link: longtapActionsValue = longtapActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.margins?.link: marginsValue = marginsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivEdgeInsetsTemplate.self) }) case parent?.maxLines?.link: maxLinesValue = maxLinesValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.maxLinesValidator) }) case parent?.minHiddenLines?.link: minHiddenLinesValue = minHiddenLinesValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.minHiddenLinesValidator) }) case parent?.paddings?.link: paddingsValue = paddingsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivEdgeInsetsTemplate.self) }) case parent?.pressEndActions?.link: pressEndActionsValue = pressEndActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.pressStartActions?.link: pressStartActionsValue = pressStartActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.ranges?.link: rangesValue = rangesValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextTemplate.RangeTemplate.self) }) case parent?.reuseId?.link: reuseIdValue = reuseIdValue.merged(with: { deserialize(__dictValue) }) case parent?.rowSpan?.link: rowSpanValue = rowSpanValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.rowSpanValidator) }) case parent?.selectable?.link: selectableValue = selectableValue.merged(with: { deserialize(__dictValue) }) case parent?.selectedActions?.link: selectedActionsValue = selectedActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivActionTemplate.self) }) case parent?.strike?.link: strikeValue = strikeValue.merged(with: { deserialize(__dictValue) }) case parent?.text?.link: textValue = textValue.merged(with: { deserialize(__dictValue) }) case parent?.textAlignmentHorizontal?.link: textAlignmentHorizontalValue = textAlignmentHorizontalValue.merged(with: { deserialize(__dictValue) }) case parent?.textAlignmentVertical?.link: textAlignmentVerticalValue = textAlignmentVerticalValue.merged(with: { deserialize(__dictValue) }) case parent?.textColor?.link: textColorValue = textColorValue.merged(with: { deserialize(__dictValue, transform: Color.color(withHexString:)) }) case parent?.textGradient?.link: textGradientValue = textGradientValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTextGradientTemplate.self) }) case parent?.textShadow?.link: textShadowValue = textShadowValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivShadowTemplate.self) }) case parent?.tightenWidth?.link: tightenWidthValue = tightenWidthValue.merged(with: { deserialize(__dictValue) }) case parent?.tooltips?.link: tooltipsValue = tooltipsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTooltipTemplate.self) }) case parent?.transform?.link: transformValue = transformValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTransformTemplate.self) }) case parent?.transformations?.link: transformationsValue = transformationsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTransformationTemplate.self) }) case parent?.transitionChange?.link: transitionChangeValue = transitionChangeValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivChangeTransitionTemplate.self) }) case parent?.transitionIn?.link: transitionInValue = transitionInValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAppearanceTransitionTemplate.self) }) case parent?.transitionOut?.link: transitionOutValue = transitionOutValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivAppearanceTransitionTemplate.self) }) case parent?.transitionTriggers?.link: transitionTriggersValue = transitionTriggersValue.merged(with: { deserialize(__dictValue, validator: ResolvedValue.transitionTriggersValidator) }) case parent?.truncate?.link: truncateValue = truncateValue.merged(with: { deserialize(__dictValue) }) case parent?.underline?.link: underlineValue = underlineValue.merged(with: { deserialize(__dictValue) }) case parent?.variableTriggers?.link: variableTriggersValue = variableTriggersValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivTriggerTemplate.self) }) case parent?.variables?.link: variablesValue = variablesValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivVariableTemplate.self) }) case parent?.visibility?.link: visibilityValue = visibilityValue.merged(with: { deserialize(__dictValue) }) case parent?.visibilityAction?.link: visibilityActionValue = visibilityActionValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivVisibilityActionTemplate.self) }) case parent?.visibilityActions?.link: visibilityActionsValue = visibilityActionsValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivVisibilityActionTemplate.self) }) case parent?.width?.link: widthValue = widthValue.merged(with: { deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, type: DivSizeTemplate.self) }) default: break } } if let parent = parent { _ = accessibilityValue = accessibilityValue.merged(with: { parent.accessibility?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = actionValue = actionValue.merged(with: { parent.action?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = actionAnimationValue = actionAnimationValue.merged(with: { parent.actionAnimation?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = actionsValue = actionsValue.merged(with: { parent.actions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = animatorsValue = animatorsValue.merged(with: { parent.animators?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = backgroundValue = backgroundValue.merged(with: { parent.background?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = borderValue = borderValue.merged(with: { parent.border?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = disappearActionsValue = disappearActionsValue.merged(with: { parent.disappearActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = doubletapActionsValue = doubletapActionsValue.merged(with: { parent.doubletapActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = ellipsisValue = ellipsisValue.merged(with: { parent.ellipsis?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = extensionsValue = extensionsValue.merged(with: { parent.extensions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = focusValue = focusValue.merged(with: { parent.focus?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = functionsValue = functionsValue.merged(with: { parent.functions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = heightValue = heightValue.merged(with: { parent.height?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = hoverEndActionsValue = hoverEndActionsValue.merged(with: { parent.hoverEndActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = hoverStartActionsValue = hoverStartActionsValue.merged(with: { parent.hoverStartActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = imagesValue = imagesValue.merged(with: { parent.images?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = layoutProviderValue = layoutProviderValue.merged(with: { parent.layoutProvider?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = longtapActionsValue = longtapActionsValue.merged(with: { parent.longtapActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = marginsValue = marginsValue.merged(with: { parent.margins?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = paddingsValue = paddingsValue.merged(with: { parent.paddings?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = pressEndActionsValue = pressEndActionsValue.merged(with: { parent.pressEndActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = pressStartActionsValue = pressStartActionsValue.merged(with: { parent.pressStartActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = rangesValue = rangesValue.merged(with: { parent.ranges?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = selectedActionsValue = selectedActionsValue.merged(with: { parent.selectedActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = textGradientValue = textGradientValue.merged(with: { parent.textGradient?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = textShadowValue = textShadowValue.merged(with: { parent.textShadow?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = tooltipsValue = tooltipsValue.merged(with: { parent.tooltips?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = transformValue = transformValue.merged(with: { parent.transform?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = transformationsValue = transformationsValue.merged(with: { parent.transformations?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = transitionChangeValue = transitionChangeValue.merged(with: { parent.transitionChange?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = transitionInValue = transitionInValue.merged(with: { parent.transitionIn?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = transitionOutValue = transitionOutValue.merged(with: { parent.transitionOut?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = variableTriggersValue = variableTriggersValue.merged(with: { parent.variableTriggers?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = variablesValue = variablesValue.merged(with: { parent.variables?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = visibilityActionValue = visibilityActionValue.merged(with: { parent.visibilityAction?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = visibilityActionsValue = visibilityActionsValue.merged(with: { parent.visibilityActions?.resolveOptionalValue(context: context, useOnlyLinks: true) }) _ = widthValue = widthValue.merged(with: { parent.width?.resolveOptionalValue(context: context, useOnlyLinks: true) }) } var errors = mergeErrors( accessibilityValue.errorsOrWarnings?.map { .nestedObjectError(field: "accessibility", error: $0) }, actionValue.errorsOrWarnings?.map { .nestedObjectError(field: "action", error: $0) }, actionAnimationValue.errorsOrWarnings?.map { .nestedObjectError(field: "action_animation", error: $0) }, actionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "actions", error: $0) }, alignmentHorizontalValue.errorsOrWarnings?.map { .nestedObjectError(field: "alignment_horizontal", error: $0) }, alignmentVerticalValue.errorsOrWarnings?.map { .nestedObjectError(field: "alignment_vertical", error: $0) }, alphaValue.errorsOrWarnings?.map { .nestedObjectError(field: "alpha", error: $0) }, animatorsValue.errorsOrWarnings?.map { .nestedObjectError(field: "animators", error: $0) }, autoEllipsizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "auto_ellipsize", error: $0) }, backgroundValue.errorsOrWarnings?.map { .nestedObjectError(field: "background", error: $0) }, borderValue.errorsOrWarnings?.map { .nestedObjectError(field: "border", error: $0) }, captureFocusOnActionValue.errorsOrWarnings?.map { .nestedObjectError(field: "capture_focus_on_action", error: $0) }, columnSpanValue.errorsOrWarnings?.map { .nestedObjectError(field: "column_span", error: $0) }, disappearActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "disappear_actions", error: $0) }, doubletapActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "doubletap_actions", error: $0) }, ellipsisValue.errorsOrWarnings?.map { .nestedObjectError(field: "ellipsis", error: $0) }, extensionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "extensions", error: $0) }, focusValue.errorsOrWarnings?.map { .nestedObjectError(field: "focus", error: $0) }, focusedTextColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "focused_text_color", error: $0) }, fontFamilyValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_family", error: $0) }, fontFeatureSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_feature_settings", error: $0) }, fontSizeValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size", error: $0) }, fontSizeUnitValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_size_unit", error: $0) }, fontVariationSettingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_variation_settings", error: $0) }, fontWeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight", error: $0) }, fontWeightValueValue.errorsOrWarnings?.map { .nestedObjectError(field: "font_weight_value", error: $0) }, functionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "functions", error: $0) }, heightValue.errorsOrWarnings?.map { .nestedObjectError(field: "height", error: $0) }, hoverEndActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "hover_end_actions", error: $0) }, hoverStartActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "hover_start_actions", error: $0) }, idValue.errorsOrWarnings?.map { .nestedObjectError(field: "id", error: $0) }, imagesValue.errorsOrWarnings?.map { .nestedObjectError(field: "images", error: $0) }, layoutProviderValue.errorsOrWarnings?.map { .nestedObjectError(field: "layout_provider", error: $0) }, letterSpacingValue.errorsOrWarnings?.map { .nestedObjectError(field: "letter_spacing", error: $0) }, lineHeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "line_height", error: $0) }, longtapActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "longtap_actions", error: $0) }, marginsValue.errorsOrWarnings?.map { .nestedObjectError(field: "margins", error: $0) }, maxLinesValue.errorsOrWarnings?.map { .nestedObjectError(field: "max_lines", error: $0) }, minHiddenLinesValue.errorsOrWarnings?.map { .nestedObjectError(field: "min_hidden_lines", error: $0) }, paddingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "paddings", error: $0) }, pressEndActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "press_end_actions", error: $0) }, pressStartActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "press_start_actions", error: $0) }, rangesValue.errorsOrWarnings?.map { .nestedObjectError(field: "ranges", error: $0) }, reuseIdValue.errorsOrWarnings?.map { .nestedObjectError(field: "reuse_id", error: $0) }, rowSpanValue.errorsOrWarnings?.map { .nestedObjectError(field: "row_span", error: $0) }, selectableValue.errorsOrWarnings?.map { .nestedObjectError(field: "selectable", error: $0) }, selectedActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "selected_actions", error: $0) }, strikeValue.errorsOrWarnings?.map { .nestedObjectError(field: "strike", error: $0) }, textValue.errorsOrWarnings?.map { .nestedObjectError(field: "text", error: $0) }, textAlignmentHorizontalValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_alignment_horizontal", error: $0) }, textAlignmentVerticalValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_alignment_vertical", error: $0) }, textColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_color", error: $0) }, textGradientValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_gradient", error: $0) }, textShadowValue.errorsOrWarnings?.map { .nestedObjectError(field: "text_shadow", error: $0) }, tightenWidthValue.errorsOrWarnings?.map { .nestedObjectError(field: "tighten_width", error: $0) }, tooltipsValue.errorsOrWarnings?.map { .nestedObjectError(field: "tooltips", error: $0) }, transformValue.errorsOrWarnings?.map { .nestedObjectError(field: "transform", error: $0) }, transformationsValue.errorsOrWarnings?.map { .nestedObjectError(field: "transformations", error: $0) }, transitionChangeValue.errorsOrWarnings?.map { .nestedObjectError(field: "transition_change", error: $0) }, transitionInValue.errorsOrWarnings?.map { .nestedObjectError(field: "transition_in", error: $0) }, transitionOutValue.errorsOrWarnings?.map { .nestedObjectError(field: "transition_out", error: $0) }, transitionTriggersValue.errorsOrWarnings?.map { .nestedObjectError(field: "transition_triggers", error: $0) }, truncateValue.errorsOrWarnings?.map { .nestedObjectError(field: "truncate", error: $0) }, underlineValue.errorsOrWarnings?.map { .nestedObjectError(field: "underline", error: $0) }, variableTriggersValue.errorsOrWarnings?.map { .nestedObjectError(field: "variable_triggers", error: $0) }, variablesValue.errorsOrWarnings?.map { .nestedObjectError(field: "variables", error: $0) }, visibilityValue.errorsOrWarnings?.map { .nestedObjectError(field: "visibility", error: $0) }, visibilityActionValue.errorsOrWarnings?.map { .nestedObjectError(field: "visibility_action", error: $0) }, visibilityActionsValue.errorsOrWarnings?.map { .nestedObjectError(field: "visibility_actions", error: $0) }, widthValue.errorsOrWarnings?.map { .nestedObjectError(field: "width", error: $0) } ) if case .noValue = textValue { errors.append(.requiredFieldIsMissing(field: "text")) } guard let textNonNil = textValue.value else { return .failure(NonEmptyArray(errors)!) } let result = DivText( accessibility: accessibilityValue.value, action: actionValue.value, actionAnimation: actionAnimationValue.value, actions: actionsValue.value, alignmentHorizontal: alignmentHorizontalValue.value, alignmentVertical: alignmentVerticalValue.value, alpha: alphaValue.value, animators: animatorsValue.value, autoEllipsize: autoEllipsizeValue.value, background: backgroundValue.value, border: borderValue.value, captureFocusOnAction: captureFocusOnActionValue.value, columnSpan: columnSpanValue.value, disappearActions: disappearActionsValue.value, doubletapActions: doubletapActionsValue.value, ellipsis: ellipsisValue.value, extensions: extensionsValue.value, focus: focusValue.value, focusedTextColor: focusedTextColorValue.value, fontFamily: fontFamilyValue.value, fontFeatureSettings: fontFeatureSettingsValue.value, fontSize: fontSizeValue.value, fontSizeUnit: fontSizeUnitValue.value, fontVariationSettings: fontVariationSettingsValue.value, fontWeight: fontWeightValue.value, fontWeightValue: fontWeightValueValue.value, functions: functionsValue.value, height: heightValue.value, hoverEndActions: hoverEndActionsValue.value, hoverStartActions: hoverStartActionsValue.value, id: idValue.value, images: imagesValue.value, layoutProvider: layoutProviderValue.value, letterSpacing: letterSpacingValue.value, lineHeight: lineHeightValue.value, longtapActions: longtapActionsValue.value, margins: marginsValue.value, maxLines: maxLinesValue.value, minHiddenLines: minHiddenLinesValue.value, paddings: paddingsValue.value, pressEndActions: pressEndActionsValue.value, pressStartActions: pressStartActionsValue.value, ranges: rangesValue.value, reuseId: reuseIdValue.value, rowSpan: rowSpanValue.value, selectable: selectableValue.value, selectedActions: selectedActionsValue.value, strike: strikeValue.value, text: textNonNil, textAlignmentHorizontal: textAlignmentHorizontalValue.value, textAlignmentVertical: textAlignmentVerticalValue.value, textColor: textColorValue.value, textGradient: textGradientValue.value, textShadow: textShadowValue.value, tightenWidth: tightenWidthValue.value, tooltips: tooltipsValue.value, transform: transformValue.value, transformations: transformationsValue.value, transitionChange: transitionChangeValue.value, transitionIn: transitionInValue.value, transitionOut: transitionOutValue.value, transitionTriggers: transitionTriggersValue.value, truncate: truncateValue.value, underline: underlineValue.value, variableTriggers: variableTriggersValue.value, variables: variablesValue.value, visibility: visibilityValue.value, visibilityAction: visibilityActionValue.value, visibilityActions: visibilityActionsValue.value, width: widthValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } private func mergedWithParent(templates: [TemplateName: Any]) throws -> DivTextTemplate { guard let parent = parent, parent != Self.type else { return self } guard let parentTemplate = templates[parent] as? DivTextTemplate else { throw DeserializationError.unknownType(type: parent) } let mergedParent = try parentTemplate.mergedWithParent(templates: templates) return DivTextTemplate( parent: nil, accessibility: accessibility ?? mergedParent.accessibility, action: action ?? mergedParent.action, actionAnimation: actionAnimation ?? mergedParent.actionAnimation, actions: actions ?? mergedParent.actions, alignmentHorizontal: alignmentHorizontal ?? mergedParent.alignmentHorizontal, alignmentVertical: alignmentVertical ?? mergedParent.alignmentVertical, alpha: alpha ?? mergedParent.alpha, animators: animators ?? mergedParent.animators, autoEllipsize: autoEllipsize ?? mergedParent.autoEllipsize, background: background ?? mergedParent.background, border: border ?? mergedParent.border, captureFocusOnAction: captureFocusOnAction ?? mergedParent.captureFocusOnAction, columnSpan: columnSpan ?? mergedParent.columnSpan, disappearActions: disappearActions ?? mergedParent.disappearActions, doubletapActions: doubletapActions ?? mergedParent.doubletapActions, ellipsis: ellipsis ?? mergedParent.ellipsis, extensions: extensions ?? mergedParent.extensions, focus: focus ?? mergedParent.focus, focusedTextColor: focusedTextColor ?? mergedParent.focusedTextColor, fontFamily: fontFamily ?? mergedParent.fontFamily, fontFeatureSettings: fontFeatureSettings ?? mergedParent.fontFeatureSettings, fontSize: fontSize ?? mergedParent.fontSize, fontSizeUnit: fontSizeUnit ?? mergedParent.fontSizeUnit, fontVariationSettings: fontVariationSettings ?? mergedParent.fontVariationSettings, fontWeight: fontWeight ?? mergedParent.fontWeight, fontWeightValue: fontWeightValue ?? mergedParent.fontWeightValue, functions: functions ?? mergedParent.functions, height: height ?? mergedParent.height, hoverEndActions: hoverEndActions ?? mergedParent.hoverEndActions, hoverStartActions: hoverStartActions ?? mergedParent.hoverStartActions, id: id ?? mergedParent.id, images: images ?? mergedParent.images, layoutProvider: layoutProvider ?? mergedParent.layoutProvider, letterSpacing: letterSpacing ?? mergedParent.letterSpacing, lineHeight: lineHeight ?? mergedParent.lineHeight, longtapActions: longtapActions ?? mergedParent.longtapActions, margins: margins ?? mergedParent.margins, maxLines: maxLines ?? mergedParent.maxLines, minHiddenLines: minHiddenLines ?? mergedParent.minHiddenLines, paddings: paddings ?? mergedParent.paddings, pressEndActions: pressEndActions ?? mergedParent.pressEndActions, pressStartActions: pressStartActions ?? mergedParent.pressStartActions, ranges: ranges ?? mergedParent.ranges, reuseId: reuseId ?? mergedParent.reuseId, rowSpan: rowSpan ?? mergedParent.rowSpan, selectable: selectable ?? mergedParent.selectable, selectedActions: selectedActions ?? mergedParent.selectedActions, strike: strike ?? mergedParent.strike, text: text ?? mergedParent.text, textAlignmentHorizontal: textAlignmentHorizontal ?? mergedParent.textAlignmentHorizontal, textAlignmentVertical: textAlignmentVertical ?? mergedParent.textAlignmentVertical, textColor: textColor ?? mergedParent.textColor, textGradient: textGradient ?? mergedParent.textGradient, textShadow: textShadow ?? mergedParent.textShadow, tightenWidth: tightenWidth ?? mergedParent.tightenWidth, tooltips: tooltips ?? mergedParent.tooltips, transform: transform ?? mergedParent.transform, transformations: transformations ?? mergedParent.transformations, transitionChange: transitionChange ?? mergedParent.transitionChange, transitionIn: transitionIn ?? mergedParent.transitionIn, transitionOut: transitionOut ?? mergedParent.transitionOut, transitionTriggers: transitionTriggers ?? mergedParent.transitionTriggers, truncate: truncate ?? mergedParent.truncate, underline: underline ?? mergedParent.underline, variableTriggers: variableTriggers ?? mergedParent.variableTriggers, variables: variables ?? mergedParent.variables, visibility: visibility ?? mergedParent.visibility, visibilityAction: visibilityAction ?? mergedParent.visibilityAction, visibilityActions: visibilityActions ?? mergedParent.visibilityActions, width: width ?? mergedParent.width ) } public func resolveParent(templates: [TemplateName: Any]) throws -> DivTextTemplate { let merged = try mergedWithParent(templates: templates) return DivTextTemplate( parent: nil, accessibility: merged.accessibility?.tryResolveParent(templates: templates), action: merged.action?.tryResolveParent(templates: templates), actionAnimation: merged.actionAnimation?.tryResolveParent(templates: templates), actions: merged.actions?.tryResolveParent(templates: templates), alignmentHorizontal: merged.alignmentHorizontal, alignmentVertical: merged.alignmentVertical, alpha: merged.alpha, animators: merged.animators?.tryResolveParent(templates: templates), autoEllipsize: merged.autoEllipsize, background: merged.background?.tryResolveParent(templates: templates), border: merged.border?.tryResolveParent(templates: templates), captureFocusOnAction: merged.captureFocusOnAction, columnSpan: merged.columnSpan, disappearActions: merged.disappearActions?.tryResolveParent(templates: templates), doubletapActions: merged.doubletapActions?.tryResolveParent(templates: templates), ellipsis: merged.ellipsis?.tryResolveParent(templates: templates), extensions: merged.extensions?.tryResolveParent(templates: templates), focus: merged.focus?.tryResolveParent(templates: templates), focusedTextColor: merged.focusedTextColor, fontFamily: merged.fontFamily, fontFeatureSettings: merged.fontFeatureSettings, fontSize: merged.fontSize, fontSizeUnit: merged.fontSizeUnit, fontVariationSettings: merged.fontVariationSettings, fontWeight: merged.fontWeight, fontWeightValue: merged.fontWeightValue, functions: merged.functions?.tryResolveParent(templates: templates), height: merged.height?.tryResolveParent(templates: templates), hoverEndActions: merged.hoverEndActions?.tryResolveParent(templates: templates), hoverStartActions: merged.hoverStartActions?.tryResolveParent(templates: templates), id: merged.id, images: merged.images?.tryResolveParent(templates: templates), layoutProvider: merged.layoutProvider?.tryResolveParent(templates: templates), letterSpacing: merged.letterSpacing, lineHeight: merged.lineHeight, longtapActions: merged.longtapActions?.tryResolveParent(templates: templates), margins: merged.margins?.tryResolveParent(templates: templates), maxLines: merged.maxLines, minHiddenLines: merged.minHiddenLines, paddings: merged.paddings?.tryResolveParent(templates: templates), pressEndActions: merged.pressEndActions?.tryResolveParent(templates: templates), pressStartActions: merged.pressStartActions?.tryResolveParent(templates: templates), ranges: merged.ranges?.tryResolveParent(templates: templates), reuseId: merged.reuseId, rowSpan: merged.rowSpan, selectable: merged.selectable, selectedActions: merged.selectedActions?.tryResolveParent(templates: templates), strike: merged.strike, text: merged.text, textAlignmentHorizontal: merged.textAlignmentHorizontal, textAlignmentVertical: merged.textAlignmentVertical, textColor: merged.textColor, textGradient: merged.textGradient?.tryResolveParent(templates: templates), textShadow: merged.textShadow?.tryResolveParent(templates: templates), tightenWidth: merged.tightenWidth, tooltips: merged.tooltips?.tryResolveParent(templates: templates), transform: merged.transform?.tryResolveParent(templates: templates), transformations: merged.transformations?.tryResolveParent(templates: templates), transitionChange: merged.transitionChange?.tryResolveParent(templates: templates), transitionIn: merged.transitionIn?.tryResolveParent(templates: templates), transitionOut: merged.transitionOut?.tryResolveParent(templates: templates), transitionTriggers: merged.transitionTriggers, truncate: merged.truncate, underline: merged.underline, variableTriggers: merged.variableTriggers?.tryResolveParent(templates: templates), variables: merged.variables?.tryResolveParent(templates: templates), visibility: merged.visibility, visibilityAction: merged.visibilityAction?.tryResolveParent(templates: templates), visibilityActions: merged.visibilityActions?.tryResolveParent(templates: templates), width: merged.width?.tryResolveParent(templates: templates) ) } }