import React from "react";
import { defineMessages, useIntl } from "react-intl";

import { Content } from "../common/Content";
import { Headline, SubHeadline } from "../common/Headline";
import PageBreakAvoid from "../common/PageBreakAvoid";
import { Paragraph } from "../common/Text";

const messages = defineMessages({
  skills: {
    defaultMessage: "Skills",
    id: "4JISx9",
  },
});

const approxCurrentYears = {
  InvestBay: Math.round(
    (Date.now() - new Date("2024-02-01").getTime()) / 1000 / 60 / 60 / 24 / 365,
  ),
  YourPass: Math.round(
    (Date.now() - new Date("2021-06-01").getTime()) / 1000 / 60 / 60 / 24 / 365,
  ),
  YourSystemSysOps: Math.round(
    (Date.now() - new Date("2022-01-01").getTime()) / 1000 / 60 / 60 / 24 / 365,
  ),
};

const investbaySkills = [
  "DevOps",
  "Google Cloud Platform (GCP)",
  "Amazon Web Services (AWS)",
  "Gitlab",
  "Terraform",
  "Cloud infrastructure",
  "Cloud Applications",
  "Software Development Life Cycle (SDLC)",
  "Linux System Administration",
  "Go",
  "TypeScript",
  "Nix",
  "GraphQL",
  "gRPC",
  "PostgreSQL",
  "Node.js",
  "React.js",
];

const yourpassSkills = [
  "DevOps",
  "Software as a Service (SaaS)",
  "Cloud Infrastructure",
  "Kubernetes",
  "Back-end Operations",
  "Linux System Administration",
  "Amazon Web Services (AWS)",
  "Terraform",
  "Go (Programming Language)",
  "gRPC",
  "OWASP ZAP",
  "Front-End Development",
  "React.js",
  "Node.js",
  "TypeScript",
  "Nix",
  "Software Development Life Cycle (SDLC)",
  "Software Development",
  "Git",
  "PostgreSQL",
];

const yoursystemSkills = [
  "DevOps",
  "Docker Swarm",
  "Linux System Administration",
  "Back-end Operations",
  "Front-End Development",
  "Amazon Web Services (AWS)",
  "Bash",
  "Linux Server",
  "Terraform",
  "Cloud Infrastructure",
  "Cloud Applications",
  "Go (Programming Language)",
  "TypeScript",
  "Node.js",
  "Software Development Life Cycle (SDLC)",
  "Software Development",
  "Kubernetes",
  "Back-End Web Development",
  "GraphQL",
  "Git",
];

const Experience: React.FC = () => {
  const intl = useIntl();

  return (
    <>
      <PageBreakAvoid>
        <Headline level={3}>INVESTBAY s.r.o.</Headline>
        <SubHeadline level={4}>DevOps Architect</SubHeadline>
        <Content>
          <Paragraph>
            {intl.formatMessage(
              {
                defaultMessage: "February 2024 - Present",
                id: "w2Pn7j",
              },
              {
                // not used atm
                count: approxCurrentYears.InvestBay,
              },
            )}
          </Paragraph>
          <Paragraph>
            <strong>{intl.formatMessage(messages.skills)}:</strong>{" "}
            {investbaySkills.join(" · ")}
          </Paragraph>
        </Content>
      </PageBreakAvoid>

      <PageBreakAvoid>
        <Headline level={3}>YOUR PASS s.r.o.</Headline>
        <SubHeadline level={4}>DevOps Engineer</SubHeadline>
        <Content>
          <Paragraph>
            {intl.formatMessage(
              {
                defaultMessage: "July 2021 - Present ({count} years)",
                id: "6T3Cls",
              },
              {
                count: approxCurrentYears.YourPass,
              },
            )}
          </Paragraph>
          <Paragraph>
            <strong>{intl.formatMessage(messages.skills)}:</strong>{" "}
            {yourpassSkills.join(" · ")}
          </Paragraph>
        </Content>
      </PageBreakAvoid>

      <PageBreakAvoid>
        <Headline level={3}>YOUR SYSTEM s.r.o.</Headline>
        <SubHeadline level={4}>SysOps</SubHeadline>

        <Content>
          <Paragraph>
            {intl.formatMessage(
              {
                defaultMessage: "January 2022 - Present ({count} years)",
                id: "nqa9U0",
              },
              {
                count: approxCurrentYears.YourSystemSysOps,
              },
            )}
          </Paragraph>
          <Paragraph>
            <strong>{intl.formatMessage(messages.skills)}:</strong>{" "}
            {yoursystemSkills.join(" · ")}
          </Paragraph>
        </Content>

        <SubHeadline level={4}>Lead Developer/Architect</SubHeadline>

        <Content>
          <Paragraph>
            {intl.formatMessage({
              defaultMessage: "February 2016 - December 2021 (5 years)",
              id: "96SwL8",
            })}
          </Paragraph>
          <Paragraph>
            <strong>{intl.formatMessage(messages.skills)}:</strong>{" "}
            {yoursystemSkills.join(" · ")}
          </Paragraph>
        </Content>
      </PageBreakAvoid>

      <PageBreakAvoid>
        <Headline level={3}>Past experience</Headline>
        <SubHeadline level={4}>Developer</SubHeadline>

        <Content>
          <Paragraph>
            {intl.formatMessage({
              defaultMessage: "Birth - February 2016",
              id: "KtILZ7",
            })}
          </Paragraph>
          <Paragraph>
            {intl.formatMessage({
              defaultMessage:
                "Working on smaller projects such as chats, forum based websites, web based presentations, most notably a system for handling the driver training center and driving school agenda... Tinkering...",
              id: "obpLg6",
            })}
          </Paragraph>
        </Content>
      </PageBreakAvoid>
    </>
  );
};

export default Experience;
