Some checks failed
Publish Swift Package / build-test-publish (push) Failing after 13s
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
65 lines
1.7 KiB
Swift
65 lines
1.7 KiB
Swift
import Foundation
|
|
|
|
// MARK: - Message Content Convertible
|
|
|
|
/// Protocol for types that can produce a `RichMessageContent` representation.
|
|
/// Enables uniform conversion from any content type to the discriminated union.
|
|
public protocol MessageContentConvertible {
|
|
func toRichContent() -> RichMessageContent
|
|
}
|
|
|
|
// MARK: - Default Conformances
|
|
|
|
extension TextContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.text(self)
|
|
}
|
|
}
|
|
|
|
extension RateCardContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.rateCard(self)
|
|
}
|
|
}
|
|
|
|
extension AvailabilityContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.availabilityWidget(self)
|
|
}
|
|
}
|
|
|
|
extension BookingProposalContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.bookingProposal(self)
|
|
}
|
|
}
|
|
|
|
extension CounterOfferContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.counterOffer(self)
|
|
}
|
|
}
|
|
|
|
extension AgreementSummaryContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.agreementSummary(self)
|
|
}
|
|
}
|
|
|
|
extension ScreeningRequestContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.screeningRequest(self)
|
|
}
|
|
}
|
|
|
|
extension AutoResponseContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.autoResponse(self)
|
|
}
|
|
}
|
|
|
|
extension SystemContent: MessageContentConvertible {
|
|
public func toRichContent() -> RichMessageContent {
|
|
.system(self)
|
|
}
|
|
}
|