import SwiftUI
import UniformTypeIdentifiers

struct PictureRepresentation: Identifiable, Codable, Transferable {
   var id = UUID()
   var image: Data

   static var transferRepresentation: some TransferRepresentation {
      CodableRepresentation(for: PictureRepresentation.self, contentType: .product)
   }
}
extension UTType {
   nonisolated static let product = UTType(exportedAs: "com.formasterminds.pictures")
}

@Observable class ApplicationData {
   var listPictures: [PictureRepresentation]
   
   static let shared: ApplicationData = ApplicationData()
   private init() {
      listPictures = [
         PictureRepresentation(image: UIImage(named: "spot1")!.pngData()!),
         PictureRepresentation(image: UIImage(named: "spot2")!.pngData()!),
         PictureRepresentation(image: UIImage(named: "spot3")!.pngData()!)
      ]
   }
}