export interface IPost {
  service: string;
  /**
   * ID of the profile.
   */
  user: string;
  id: string;
  title?: string;
  content?: string;
  file?: {
    path?: string;
    name: string;
  };
  shared_file: boolean;
  embed: {};
  attachments: IPostAttachment[];
  added?: string;
  published?: string;
  edited?: string;
  prev?: string;
  next?: string;
  revision_id?: string;
  tags: string[] | null;
  incomplete_rewards?: string;
  poll?: IPostPoll;

  fav_count?: number;
  isFavourite?: boolean;
  isFavouriteProfile?: boolean;
}

export interface IPostRevision {
  revision_id?: string;
  added?: string;
}

export interface IPostVideo {
  index: string;
  name: string;
  caption: string;
  extension: string;
  server?: string;
  path: string;
}

export interface IPostAttachment {
  path: string;
  name: string;
  server?: string;
  extension: string;
  name_extension: string;
  stem: string;
}

export interface IPostPoll {
  title: string;
  description?: string;
  total_votes?: number;
  choices: { votes: number; text: string }[];
  created_at: string;
  closes_at: string;
  allow_multiple?: boolean;
}

export type IPostPreview = IPreviewThumbnail | IPreviewEmbed;

export interface IPreviewThumbnail {
  type: "thumbnail";
  server?: string;
  path: string;
  name: string;
  caption?: string;
}

export interface IPreviewEmbed {
  type: "embed";
  url: string;
  subject?: string;
  description?: string;
}

export interface IComment {
  id: string;
  commenter: string;
  commenter_name?: string;
  revisions?: ICommentRevision[];
  parent_id?: string;
  published: string;
  added?: string;
  content: string;
}

export interface ICommentRevision {
  id: string;
  published?: string;
  added?: string;
  content: string;
}

export interface IAnnouncement {
  service: string;
  /**
   * ID of profile.
   */
  user_id: string;
  /**
   * SHA-256 hash.
   */
  hash: string;
  content: string;
  /**
   * ISO datetime without timezone.
   */
  added: string;
  /**
   * ISO datetime without timezone.
   */
  published?: string;
}

export interface IDiscordChannelMessage {
  id: string;
  author: IDiscordChannelMessageAuthor;
  server: string;
  channel: string;
  content: string;
  added: string;
  published: string;
  edited: string;
  embeds: IDiscordEmbed[];
  mentions: unknown[];
  attachments: IDiscordAttachment[];
}

export interface IDiscordChannelMessageAuthor {
  id: string;
  avatar: string;
  username: string;
  public_flags: number;

  discriminator: string;
}

export interface IDiscordAttachment {
  name: string;
  path: string;
}

export interface IDiscordEmbed {
  url: string;
  title?: string;
  description?: string;
}
