import type {Activity, ObjectRef, ObjectRefs, ObjectType} from 'mammoth-activitystreams';
import type {Actor, APObject} from 'mammoth-activitypub';

export interface User {
    userId: string;
    password: string;
    hashedPassword: string;
    email: string;
    userDb: string;

    publicKey: string;
    privateKey: string;
    admin: boolean;
}

export enum NotificationType {
    LikedUsersPost = 'LikedUsersPost',
    LikedUsersReply = 'LikedUsersReply',
    LikedUser = 'LikedUser',
    RepliedToUsersPost = 'RepliedToUsersPost',
    RepliedToUsersReply = 'RepliedToUsersReply',
    EditedAPostUserRespondedTo = 'EditedAPostUserRespondedTo',
    EditedAReplyUserRespondedTo = 'EditedAReplyUserRespondedTo',
    SentUserAFollowRequest = 'SentUserAFollowRequest',
    AcceptedUsersFollowRequest = 'AcceptedUsersFollowRequest',
    SharedUsersPost = 'SharedUsersPost',
    SentUserAFriendRequest = 'SentUserAFriendRequest',
    AcceptedUsersFriendRequest = 'AcceptedUsersFriendRequest'
}

export interface Notification {
    id: string;
    type: 'Notification';
    activity: NotificationType;   // what the notification is about
    published: string;            // most recent update
    object: ObjectRefs<APObject>; // reference(s) to the object(s) in question, e.g., Follow, Like
    target: ObjectRef<APObject>;  // reference to the object they targeted e.g., user's actor, or a Note
    actor: ObjectRefs<Actor>;     // the Actor(s) who did the things
    aggregation: string;          // ID of the aggregation we're a part of.
    read: boolean;
}

export interface NotificationAggregation {
    id: string;
    type: 'NotificationAggregation';
    activity: ObjectType;                   // the type of activity
    object: ObjectRef<Activity>;            // what they're notified about
    read: boolean;
}

export enum FetchInstruction {
    Resolve = 'Resolve',
    PopulateCollection = 'PopulateCollection'
}

export type FetchInstructions = {
    recursive?: boolean;
    type?: 'Object' | 'Collection';
    fetch?: { [key: string]: FetchInstruction | FetchInstructions };
};

