Files
feldspar e0efea91d0 Nested types fix
commit_hash:0e61cb86c4ecce349d6b76477d5f025a5896aa81
2026-02-26 13:21:52 +03:00

65 lines
1.8 KiB
Swift

// Generated code. Do not modify.
import Foundation
import Serialization
import VGSL
@frozen
public enum DivPagerLayoutMode: Sendable {
case divPageSize(DivPageSize)
case divNeighbourPageSize(DivNeighbourPageSize)
case divPageContentSize(DivPageContentSize)
public var value: Serializable {
switch self {
case let .divPageSize(value):
return value
case let .divNeighbourPageSize(value):
return value
case let .divPageContentSize(value):
return value
}
}
}
extension DivPagerLayoutMode {
public init(dictionary: [String: Any], context: ParsingContext) throws {
let dictionary = context.templateResolver?(dictionary) ?? dictionary
let blockType = try dictionary.getField("type") as String
switch blockType {
case DivPageSize.type:
self = .divPageSize(try DivPageSize(dictionary: dictionary, context: context))
case DivNeighbourPageSize.type:
self = .divNeighbourPageSize(try DivNeighbourPageSize(dictionary: dictionary, context: context))
case DivPageContentSize.type:
self = .divPageContentSize(try DivPageContentSize(dictionary: dictionary, context: context))
default:
throw DeserializationError.requiredFieldIsMissing(field: "type")
}
}
}
#if DEBUG
extension DivPagerLayoutMode: Equatable {
public static func ==(lhs: DivPagerLayoutMode, rhs: DivPagerLayoutMode) -> Bool {
switch (lhs, rhs) {
case let (.divPageSize(l), .divPageSize(r)):
return l == r
case let (.divNeighbourPageSize(l), .divNeighbourPageSize(r)):
return l == r
case let (.divPageContentSize(l), .divPageContentSize(r)):
return l == r
default:
return false
}
}
}
#endif
extension DivPagerLayoutMode: Serializable {
@_optimize(size)
public func toDictionary() -> [String: ValidSerializationValue] {
return value.toDictionary()
}
}