// This file is part of Coog. The COPYRIGHT file at the top level of
// this repository contains the full copyright notices and license terms.

import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faFilePdf, faFilePowerpoint, faFileWord, faFileExcel, faFile } from '@fortawesome/free-solid-svg-icons';

import { fileTypes } from './Card.types';

export interface iFileCard {
  fileCard?: boolean;
  fileType?: fileTypes;
}

const CardFile = ({ fileCard = false, fileType }: iFileCard): JSX.Element => {
  if (!fileCard) return <></>;
  switch (fileType) {
    case 'pdf':
      return (
        <div className={`type ${fileType}`}>
          <FontAwesomeIcon className="icon" icon={faFilePdf} />
          <div className="label">{fileType}</div>
        </div>
      );
    case 'word':
      return (
        <div className={`type ${fileType}`}>
          <FontAwesomeIcon className="icon" icon={faFileWord} />
          <div className="label">{fileType}</div>
        </div>
      );
    case 'excel':
      return (
        <div className={`type ${fileType}`}>
          <FontAwesomeIcon className="icon" icon={faFileExcel} />
          <div className="label">{fileType}</div>
        </div>
      );
    case 'powerpoint':
      return (
        <div className={`type ${fileType}`}>
          <FontAwesomeIcon className="icon" icon={faFilePowerpoint} />
          <div className="label">{fileType}</div>
        </div>
      );

    default:
      return (
        <div className="type">
          <FontAwesomeIcon icon={faFile} />
        </div>
      );
  }
};

export default CardFile;
