Files
divkit/client/ios/DivKitTests/Entities/generated_sources/EntityWithStringEnumPropertyWithDefaultValue.swift
denlvovich e001d74afe Update to VGSL6.0
4f8b5f480ade3f347d5f0a2d01a1618069bcb846
2024-07-12 20:33:42 +03:00

52 lines
1.3 KiB
Swift

// Generated code. Do not modify.
@testable import DivKit
import Foundation
import Serialization
import VGSL
public final class EntityWithStringEnumPropertyWithDefaultValue {
@frozen
public enum Value: String, CaseIterable {
case first = "first"
case second = "second"
case third = "third"
}
public static let type: String = "entity_with_string_enum_property_with_default_value"
public let value: Expression<Value> // default value: second
public func resolveValue(_ resolver: ExpressionResolver) -> Value {
resolver.resolveEnum(value) ?? Value.second
}
init(
value: Expression<Value>? = nil
) {
self.value = value ?? .value(.second)
}
}
#if DEBUG
extension EntityWithStringEnumPropertyWithDefaultValue: Equatable {
public static func ==(lhs: EntityWithStringEnumPropertyWithDefaultValue, rhs: EntityWithStringEnumPropertyWithDefaultValue) -> Bool {
guard
lhs.value == rhs.value
else {
return false
}
return true
}
}
#endif
extension EntityWithStringEnumPropertyWithDefaultValue: Serializable {
public func toDictionary() -> [String: ValidSerializationValue] {
var result: [String: ValidSerializationValue] = [:]
result["type"] = Self.type
result["value"] = value.toValidSerializationValue()
return result
}
}