import { css } from "@emotion/react";
import styled from "@emotion/styled";
const TriggerContainer = styled.div`
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--canvas-background);
  border: 1.5px solid var(--canvas-border-de-emp);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  ${({ selected })=>selected ? css`
          border-color: var(--canvas-primary);
          outline: 4px solid var(--canvas-secondary-pressed);
        ` : css`
          &:hover {
            outline: 4px solid var(--canvas-secondary-pressed);
          }
        `}

  ${({ status })=>'Completed' === status && css`
      border-color: var(--canvas-success-icon);
    `}

  ${({ status })=>'InProgress' === status && css`
      border-color: var(--canvas-info-icon);
    `}

  ${({ status })=>'Paused' === status && css`
      border-color: var(--canvas-warning-icon);
    `}

  ${({ status })=>'Failed' === status && css`
      border-color: var(--canvas-error-icon);
    `}

  ${({ status })=>'NotExecuted' === status && css`
      opacity: 0.8;
    `}
`;
const TriggerIconWrapper = styled.div`
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--canvas-foreground);
  background: var(--canvas-background-secondary);
  border-radius: 50%;

  width: ${({ nodeHeight })=>{
    const scaleFactor = nodeHeight ? nodeHeight / 96 : 1;
    return `${72 * scaleFactor}px`;
}};
  height: ${({ nodeHeight })=>{
    const scaleFactor = nodeHeight ? nodeHeight / 96 : 1;
    return `${72 * scaleFactor}px`;
}};

  ${({ status })=>'Completed' === status && css`
      color: var(--canvas-success-icon);
    `}

  ${({ status })=>'InProgress' === status && css`
      color: var(--canvas-info-icon);
    `}

  ${({ status })=>'Paused' === status && css`
      color: var(--canvas-warning-icon);
    `}

  ${({ status })=>'Failed' === status && css`
      color: var(--canvas-error-icon);
    `}

  svg {
    width: ${({ nodeHeight })=>{
    const scaleFactor = nodeHeight ? nodeHeight / 96 : 1;
    return `${40 * scaleFactor}px`;
}};
    height: ${({ nodeHeight })=>{
    const scaleFactor = nodeHeight ? nodeHeight / 96 : 1;
    return `${40 * scaleFactor}px`;
}};
  }
`;
export { TriggerContainer, TriggerIconWrapper };
