// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

import type { ReadonlyDeep } from 'type-fest';

import type { ReadonlyMessageAttributesType } from '../model-types.d.ts';

export enum PanelType {
  AllMedia = 'AllMedia',
  ChatColorEditor = 'ChatColorEditor',
  ContactDetails = 'ContactDetails',
  ConversationDetails = 'ConversationDetails',
  GroupInvites = 'GroupInvites',
  GroupLinkManagement = 'GroupLinkManagement',
  GroupPermissions = 'GroupPermissions',
  GroupV1Members = 'GroupV1Members',
  MessageDetails = 'MessageDetails',
  NotificationSettings = 'NotificationSettings',
  PinnedMessages = 'PinnedMessages',
  StickerManager = 'StickerManager',
}

export type PanelRequestType = ReadonlyDeep<
  | { type: PanelType.AllMedia }
  | { type: PanelType.ChatColorEditor }
  | {
      type: PanelType.ContactDetails;
      args: {
        messageId: string;
      };
    }
  | { type: PanelType.ConversationDetails }
  | { type: PanelType.GroupInvites }
  | { type: PanelType.GroupLinkManagement }
  | { type: PanelType.GroupPermissions }
  | { type: PanelType.GroupV1Members }
  | { type: PanelType.MessageDetails; args: { messageId: string } }
  | { type: PanelType.NotificationSettings }
  | { type: PanelType.PinnedMessages }
  | { type: PanelType.StickerManager }
>;

export type PanelRenderType = ReadonlyDeep<
  | { type: PanelType.AllMedia }
  | { type: PanelType.ChatColorEditor }
  | {
      type: PanelType.ContactDetails;
      args: {
        messageId: string;
      };
    }
  | { type: PanelType.ConversationDetails }
  | { type: PanelType.GroupInvites }
  | { type: PanelType.GroupLinkManagement }
  | { type: PanelType.GroupPermissions }
  | { type: PanelType.GroupV1Members }
  | {
      type: PanelType.MessageDetails;
      args: { message: ReadonlyMessageAttributesType };
    }
  | { type: PanelType.NotificationSettings }
  | { type: PanelType.PinnedMessages }
  | { type: PanelType.StickerManager }
>;
