import { type LearningCertificateAlignment } from 'src/pages/dashboard/Learning/Settings/Certificates/types';

import { type COLOR_TYPE } from './constants';

export type ColorType = (typeof COLOR_TYPE)[keyof typeof COLOR_TYPE];

/** Shade keys available in every newBase hue ramp. */
export type Shade = 50 | 100 | 200 | 300 | 500 | 600 | 700 | 800 | 900 | 950;

/** newBase hues used by the certificate color schemes. */
export type CertificateHue =
  | 'brand'
  | 'skyBlue'
  | 'purple'
  | 'mulberry'
  | 'tan'
  | 'lime'
  | 'blackInk'
  | 'grey';

/**
 * Classic token spec per accent color, matching the backend `classic` scheme.
 * Each shade resolves against `theme.palette.newBase[hue]`; `bg: 'white'`
 * resolves to `newBase.white`. `bodyText`/`wordmarkInvert` derive from `isDark`.
 */
export type ClassicTokenSpec = {
  hue: CertificateHue;
  bg: Shade | 'white';
  /** Frames + main corner stroke (backend `accentDot`). */
  border1: Shade;
  /** Header divider + diamond line (backend `borderOuter`). */
  border2: Shade;
  /** Diamond + inner corner stroke (backend `borderInner`). */
  border3: Shade;
  /** Title, name, signature line (backend `text`). */
  text: Shade;
  isDark: boolean;
};

/**
 * Modern token spec per accent color, matching the backend `modern` scheme.
 * The sidebar gradient runs `gradientTop` → `gradientBottom`.
 */
export type ModernTokenSpec = {
  hue: CertificateHue;
  /** Title + recipient name (backend `text`). */
  titleColor: Shade;
  /** Top of the left sidebar gradient (backend `gradientTop`). */
  gradientTop: Shade | 'white';
  /** Bottom of the left sidebar gradient (backend `gradientBottom`). */
  gradientBottom: Shade | 'white';
  /** Diamond, diamond line, signature border (backend `accentDot`). */
  accentColor: Shade;
};

/** Args for the shared header style factory. */
export type HeaderStyleArgs = {
  /** Inverts the Humand wordmark to white (dark backgrounds). */
  wordmarkInvert: boolean;
  /** Color of the divider below the header. */
  dividerColor: string | undefined;
};

/** Args for the shared signatures style factory. */
export type SignaturesStyleArgs = {
  textAlignment: LearningCertificateAlignment;
  /** Color of the line above the signer name. */
  borderColor: string;
  nameColor: string | undefined;
  roleColor: string | undefined;
  nameFontSize: string;
  roleFontSize: string;
};
