vds_ios/VDS/Components/RadioBox/RadioBoxModel.swift
Matt Bruce 7b6a62eae7 removed errorable from radiobox
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2022-09-08 15:30:35 -05:00

91 lines
2.7 KiB
Swift

//
// RadioBoxModel.swift
// VDS
//
// Created by Matt Bruce on 8/23/22.
//
import Foundation
import UIKit
public protocol RadioBoxModel: Modelable, FormFieldable, DataTrackable, Accessable, Selectable, BinaryColorable {
var text: String { get set }
var textAttributes: [LabelAttributeModel]? { get set }
var subText: String? { get set }
var subTextAttributes: [LabelAttributeModel]? { get set }
var subTextRight: String? { get set }
var subTextRightAttributes: [LabelAttributeModel]? { get set }
var strikethrough: Bool { get set }
}
extension RadioBoxModel {
public var textModel: DefaultLabelModel {
var model = DefaultLabelModel()
model.textPosition = .left
model.typograpicalStyle = .BoldBodyLarge
model.text = text
model.surface = surface
model.disabled = disabled
model.attributes = textAttributes
return model
}
public var subTextModel: DefaultLabelModel? {
guard let subText else { return nil }
var model = DefaultLabelModel()
model.textPosition = .left
model.typograpicalStyle = .BodyLarge
model.text = subText
model.surface = surface
model.disabled = disabled
model.attributes = subTextAttributes
return model
}
public var subTextRightModel: DefaultLabelModel? {
guard let subTextRight else { return nil }
var model = DefaultLabelModel()
model.textPosition = .right
model.typograpicalStyle = .BodyLarge
model.text = subTextRight
model.surface = surface
model.disabled = disabled
model.attributes = subTextRightAttributes
return model
}
}
public struct DefaultRadioBoxModel: RadioBoxModel {
public var selected: Bool = false
public var text: String = "Default Text"
public var textAttributes: [LabelAttributeModel]?
public var subText: String?
public var subTextAttributes: [LabelAttributeModel]?
public var subTextRight: String?
public var subTextRightAttributes: [LabelAttributeModel]?
public var selectedAccentColor: UIColor?
public var strikethrough: Bool = false
public var inputId: String?
public var value: AnyHashable?
public var surface: Surface = .light
public var disabled: Bool = false
public var dataAnalyticsTrack: String?
public var dataClickStream: String?
public var dataTrack: String?
public var accessibilityHintEnabled: String?
public var accessibilityHintDisabled: String?
public var accessibilityValueEnabled: String?
public var accessibilityValueDisabled: String?
public var accessibilityLabelEnabled: String?
public var accessibilityLabelDisabled: String?
public init() {}
}