//namespace ActivityPub;
/////
///// A class to create ActivityPub Objects/Activities/etc from an incoming dynamic object
/////
//public static class DynamicObjectFactory {
// public static ObjectOrLink? NewObjectOrLink(dynamic that) {
// if (that is string) return (ObjectOrLink) new Uri((string)that);
// if (that is Uri) return (ObjectOrLink)that;
// string type = that.Type;
// if (type == null) return null; // TODO: throw exception?
// type = Types.Normalize(type);
// ObjectOrLink newObject;
// switch (type) {
// // https://www.w3.org/TR/activitystreams-vocabulary/#types
// case "Object": return (ObjectOrLink)NewObject(that);
// case "Link": return (ObjectOrLink)NewLink(that);
// case "Activity": return (ObjectOrLink)NewActivity(that);
// case "IntransitiveActivity": return (ObjectOrLink)NewIntransitiveActivity(that);
// case "Collection": return (ObjectOrLink)NewCollection(that);
// case "OrderedCollection": return (ObjectOrLink)NewOrderedCollection(that);
// case "CollectionPage": return (ObjectOrLink)NewCollectionPage(that);
// case "OrderedCollectionPage": return (ObjectOrLink)NewOrderedCollectionPage(that);
// // this is technically not an ActivityStreams type, but it's useful to exist
// case "Actor": return (ObjectOrLink)NewActor(that);
// // https://www.w3.org/TR/activitystreams-vocabulary/#activity-types
// case "Accept": return (ObjectOrLink)NewAccept(that);
// case "Add": return (ObjectOrLink)NewAdd(that);
// case "Announce": return (ObjectOrLink)NewAnnounce(that);
// case "Arrive": return (ObjectOrLink)NewArrive(that);
// case "Block": return (ObjectOrLink)NewBlock(that);
// case "Create": return (ObjectOrLink)NewCreate(that);
// case "Delete": return (ObjectOrLink)NewDelete(that);
// case "Dislike": return (ObjectOrLink)NewDislike(that);
// case "Flag": return (ObjectOrLink)NewFlag(that);
// case "Follow": return (ObjectOrLink)NewFollow(that);
// case "Ignore": return (ObjectOrLink)NewIgnore(that);
// case "Invite": return (ObjectOrLink)NewInvite(that);
// case "Join": return (ObjectOrLink)NewJoin(that);
// case "Leave": return (ObjectOrLink)NewLeave(that);
// case "Like": return (ObjectOrLink)NewLike(that);
// case "Listen": return (ObjectOrLink)NewListen(that);
// case "Move": return (ObjectOrLink)NewMove(that);
// case "Offer": return (ObjectOrLink)NewOffer(that);
// case "Question": return (ObjectOrLink)NewQuestion(that);
// case "Reject": return (ObjectOrLink)NewReject(that);
// case "Read": return (ObjectOrLink)NewRead(that);
// case "Remove": return (ObjectOrLink)NewRemove(that);
// case "TentativeReject": return (ObjectOrLink)NewTentativeReject(that);
// case "TentativeAccept": return (ObjectOrLink)NewTentativeAccept(that);
// case "Travel": return (ObjectOrLink)NewTravel(that);
// case "Undo": return (ObjectOrLink)NewUndo(that);
// case "Update": return (ObjectOrLink)NewUpdate(that);
// case "View": return (ObjectOrLink)NewView(that);
// // https://www.w3.org/TR/activitystreams-vocabulary/#actor-types
// case "Application": return (ObjectOrLink)NewApplication(that);
// case "Group": return (ObjectOrLink)NewGroup(that);
// case "Organization": return (ObjectOrLink)NewOrganization(that);
// case "Person": return (ObjectOrLink)NewPerson(that);
// case "Service": return (ObjectOrLink)NewService(that);
// // https://www.w3.org/TR/activitystreams-vocabulary/#object-types
// case "Article": return (ObjectOrLink)NewArticle(that);
// case "Audio": return (ObjectOrLink)NewAudio(that);
// case "Document": return (ObjectOrLink)NewDocument(that);
// case "Event": return (ObjectOrLink)NewEvent(that);
// case "Image": return (ObjectOrLink)NewImage(that);
// case "Note": return (ObjectOrLink)NewNote(that);
// case "Page": return (ObjectOrLink)NewPage(that);
// case "Place": return (ObjectOrLink)NewPlace(that);
// case "Profile": return (ObjectOrLink)NewProfile(that);
// case "Relationship": return (ObjectOrLink)NewRelationship(that);
// case "Tombstone": return (ObjectOrLink)NewTombstone(that);
// case "Video": return (ObjectOrLink)NewVideo(that);
// case "Mention": return (ObjectOrLink)NewMention(that);
// default: return null;
// }
// }
// public static ListOrLink? NewListOrLink(dynamic that) where T : KristofferStrube.ActivityStreams.Object, new() {
// if (that == null) return null;
// if (that is string) return (ListOrLink)new Uri((string)that);
// if (that is Uri) return (ListOrLink)that;
// if (that is IEnumerable)
// return (ListOrLink)(that as IEnumerable).Select(x => NewObjectOrLink(x)).Cast>().ToList();
// return null;
// }
// public static DateTimeOffset? NewDate(dynamic that) {
// DateTimeOffset result;
// if(DateTimeOffset.TryParse(that, out result)) { return result; }
// return null;
// }
// public static Object NewObject(dynamic that, Object? self = null) {
// if(self == null) self = new Object();
// self.Id = new Uri(that.Id);
// // self.Type = that.Type; // not necessary
// self.Attachment = NewObjectOrLink(that.Attachment);
// self.AttributedTo = NewObjectOrLink(that.AttributedTo);
// self.Audience = NewObjectOrLink(that.Audience);
// self.Content = that.Content;
// self.Source = NewObjectOrLink(that.Source);
// self.Context = NewObjectOrLink(that.Id);
// self.Name = that.Name;
// self.EndTime = NewDate(that.EndTime);
// self.Generator = NewObjectOrLink(that.Generator);
// self.Icon = NewObjectOrLink(that.Icon);
// self.Image = NewObjectOrLink(that.Image);
// self.InReplyTo = NewObjectOrLink(that.InReplyTo);
// self.Location = NewObjectOrLink(that.Location);
// self.Preview = NewObjectOrLink(that.Preview);
// self.Published = NewDate(that.Published);
// self.Replies = NewObjectOrLink(that.Replies);
// self.StartTime = NewDate(that.StartTime);
// self.Summary = that.Summary;
// self.Tag = NewObjectOrLink(that.Tag);
// self.Updated = NewDate(that.Id);
// self.Url = (that.Url == null || that.Url is Uri) ? that.Url : new Uri(that.Url);
// self.To = NewListOrLink