2026-07-04 10:48:57 +02:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
/// A transcription of a processed recording.
|
2026-07-04 12:11:24 +02:00
|
|
|
public struct Transcription: Equatable, Identifiable, Sendable {
|
2026-07-05 16:16:53 +02:00
|
|
|
|
2026-07-04 10:48:57 +02:00
|
|
|
// MARK: Properties
|
|
|
|
|
|
|
|
|
|
/// The unique identifier of the transcription.
|
2026-07-04 15:37:36 +02:00
|
|
|
public let id: UUID
|
2026-07-04 10:48:57 +02:00
|
|
|
|
|
|
|
|
/// The transcribed text of the processed recording.
|
|
|
|
|
public let text: String
|
2026-07-04 15:37:36 +02:00
|
|
|
|
2026-07-04 10:48:57 +02:00
|
|
|
// MARK: Initializers
|
|
|
|
|
|
|
|
|
|
/// Creates a transcription with a given text.
|
2026-07-04 15:37:36 +02:00
|
|
|
///
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - id: The unique identifier of the transcription. Defaults to a newly generated identifier.
|
|
|
|
|
/// - text: The transcribed text of the processed recording.
|
2026-07-04 10:48:57 +02:00
|
|
|
public init(
|
2026-07-04 15:37:36 +02:00
|
|
|
id: UUID = .init(),
|
2026-07-04 10:48:57 +02:00
|
|
|
text: String
|
|
|
|
|
) {
|
2026-07-04 15:37:36 +02:00
|
|
|
self.id = id
|
2026-07-04 10:48:57 +02:00
|
|
|
self.text = text
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: Computed
|
|
|
|
|
|
|
|
|
|
/// A Boolean value that indicates whether the transcription has no text.
|
2026-07-04 13:23:42 +02:00
|
|
|
public var isEmpty: Bool {
|
2026-07-04 10:48:57 +02:00
|
|
|
text.isEmpty
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|