import React, { useState } from "react";
/* -------------------------------------------------------------------------- */
/*                            imports Article parts                           */
/* -------------------------------------------------------------------------- */
import { ArticleTitle } from "./ArticleParts/ArticleTitle";
import { ArticleBreadcumbs } from "./ArticleParts/ArticleBreadcumbs";
import { ArticleAuthors } from "./ArticleParts/ArticleAuthors";
import { ArticleKeywords } from "./ArticleParts/ArticleKeywords";
import { ArticleInteractionButtons } from "./ArticleParts/InteractionButtons/ArticleInteractionButtons";
import { ArticleDescription } from "./ArticleParts/ArticleDescription";
import { ArticleSubscriptionsButtons } from "./ArticleParts/ArticleSubscriptionsButton";
import classNames from "classnames";

/**
 * Reduces a sequence of names to initials.
 * @param  {String} name  Space Delimited sequence of names.
 * @param  {String} sep   A period separating the initials.
 * @param  {String} trail A period ending the initials.
 * @param  {String} hyph  A hypen separating double names.
 * @return {String}       Properly formatted initials.
 */
type ArticleTileExtentions = {
  Title?: {
    children?: string;
    className?: string;
  };
  Breadcumbs?: {
    children?: string[];
    highlightLAstChild?: boolean;
  };
  Authors?: {
    children: React.ReactNode;
    className?: string;
    emphasis?: "low" | "high";
  };
  Keywords?: {
    children?: React.ReactNode;
    className?: string;
    emphasis?: "low" | "high";
  };
  Description?: {
    children?: React.ReactNode;
    emphasis?: "low" | "high";
    isShowing?: boolean;
  };
  InteractionButtons?: {
    children?: React.ReactNode;
    className?: string;
    emphasis?: "high" | "low";
  };
  SubscriptionButtons?: {
    className?: string;
  };
};

type ArticleTileProps = {
  className?: string;
  children?: React.ReactNode;
};

export function Article({
  className,
  children,
}: ArticleTileProps & ArticleTileExtentions) {
  const [isShowing, setIsShowing] = useState(false);

  return <div className={classNames("flex flex-col w-full", className)}>{children}</div>;
}

Article.Title = ArticleTitle;
Article.Breadcumbs = ArticleBreadcumbs;
Article.Authors = ArticleAuthors;
Article.Keywords = ArticleKeywords;
Article.InteractionButtons = ArticleInteractionButtons;
Article.Description = ArticleDescription;
Article.SubscriptionsButtons = ArticleSubscriptionsButtons;
