From ac56ee331f37c9aa5d7a6556b460bc31b5812bdb Mon Sep 17 00:00:00 2001
From: Klaus Fischer <klaus.fischer@eloware.com>
Date: Fri, 21 Oct 2022 07:34:30 +0200
Subject: [PATCH] WIP: 3.11 Schema for data

---
 FitConnect/Subscriber.cs | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/FitConnect/Subscriber.cs b/FitConnect/Subscriber.cs
index 5b1b6222..f647dc84 100644
--- a/FitConnect/Subscriber.cs
+++ b/FitConnect/Subscriber.cs
@@ -151,8 +151,9 @@ public class Subscriber : FitConnectClient,
             throw new ArgumentException("Destination not found");
         }
 
-        if (!destination.Services!.Select(s => s.Identifier)
-                .Contains(submission.Metadata.PublicServiceType.Identifier)) {
+        var destinationService = destination.Services!.FirstOrDefault(s =>
+            s.Identifier == submission.Metadata.PublicServiceType.Identifier);
+        if (destinationService == null) {
             var problem = new Problems(Problems.ProblemTypeEnum.UnsupportedService,
                 Problems.DetailUnsupportedService);
             RejectSubmission(problem);
@@ -174,6 +175,17 @@ public class Subscriber : FitConnectClient,
             throw new SecurityEventException(problem);
         }
 
+
+        // SuccessCriteria:3.11
+        // TODO get data schema for data
+        string? dataSchema = null;
+        if (dataSchema != null) {
+            if (destinationService.SubmissionSchemas.Select(s => s.SchemaUri)
+                .Contains(dataSchema)) {
+            }
+        }
+
+
         Dictionary<string, string> attachmentSignatures =
             (submitEvent.Payload as dynamic)?.authenticationTags?.attachments
             .ToObject<Dictionary<string, string>>()!;
-- 
GitLab