38 lines
1.1 KiB
Swift
38 lines
1.1 KiB
Swift
import Foundation
|
|
|
|
public struct StructuredSongProjectUpdateResponse: Codable, Equatable, Sendable {
|
|
public static let schemaName = "song_project_update_response"
|
|
|
|
public var project: SongProjectSnapshot
|
|
public var changedScopes: [SongProjectUpdateScope]
|
|
public var notes: [String]
|
|
public var followUpQuestions: [String]
|
|
|
|
public init(
|
|
project: SongProjectSnapshot,
|
|
changedScopes: [SongProjectUpdateScope] = [],
|
|
notes: [String] = [],
|
|
followUpQuestions: [String] = []
|
|
) {
|
|
self.project = project
|
|
self.changedScopes = changedScopes
|
|
self.notes = notes
|
|
self.followUpQuestions = followUpQuestions
|
|
}
|
|
|
|
public func makeUpdateResult(
|
|
updating existingProject: SongProject,
|
|
updatedAt: Date = Date()
|
|
) -> SongProjectUpdateResult {
|
|
var updatedProject = existingProject
|
|
updatedProject.restoreSnapshot(project, updatedAt: updatedAt)
|
|
|
|
return SongProjectUpdateResult(
|
|
project: updatedProject,
|
|
changedScopes: changedScopes,
|
|
notes: notes,
|
|
followUpQuestions: followUpQuestions
|
|
)
|
|
}
|
|
}
|