import type { PrintLayoutTemplate, PrintFileFormat } from "../../rest/support/types.js";

/** @since 5.0 */
export interface TemplateInfo<ValueType> {
  /**
   * A list of supported layouts.
   *
   * @since 5.0
   */
  choiceList: ValueType[];
  /**
   * The default layout selected by the print service.
   *
   * @since 5.0
   */
  defaultValue: ValueType;
}

/** @since 5.0 */
export interface TemplatesInfo {
  /**
   * Metadata about the available output formats.
   *
   * @since 5.0
   */
  format: TemplateInfo<PrintFileFormat>;
  /**
   * Metadata about the available page layouts.
   *
   * @since 5.0
   */
  layout: TemplateInfo<PrintLayoutTemplate>;
}

/** @since 5.0 */
export type Layout = string;

/** @since 5.0 */
export type Layouts = "all" | Layout[];

/** @since 5.0 */
export type Format = string;

/** @since 5.0 */
export type Formats = "all" | Format[];

/** @since 5.0 */
export type State = "ready" | "initializing" | "disabled" | "error";

/** @since 5.0 */
export type CustomTextElement = Record<string, string>;

/** @since 5.0 */
export type TemplateCustomTextElements = Record<string, CustomTextElement[]>;

/** @since 5.0 */
export interface MapSurroundInfo {}

/** @since 5.0 */
export interface LayoutTemplateInfo {
  /**
   * Defines the layout elements.
   *
   * @since 5.0
   */
  layoutOptions: LayoutTemplateInfoLayoutOptions;
  /**
   * The default page size(s) to be used.
   *
   * @since 5.0
   */
  pageSize: [
      number,
      number
  ];
  /**
   * The unit type of the page size(s) to be used.
   *
   * @since 5.0
   */
  pageUnits: string;
}

/** @since 5.0 */
export interface LayoutTemplateInfoLayoutOptions {
  /**
   * The CustomTextElements in layoutOptions.
   *
   * @since 5.0
   */
  customTextElements: CustomTextElement[];
  /**
   * Author text in layoutOptions.
   *
   * @since 5.0
   */
  hasAuthorText: boolean;
  /**
   * Copyright text in layoutOptions.
   *
   * @since 5.0
   */
  hasCopyrightText: boolean;
  /**
   * Legend in layoutOptions.
   *
   * @since 5.0
   */
  hasLegend: boolean;
  /**
   * Title text in layoutOptions.
   *
   * @since 5.0
   */
  hasTitleText: boolean;
  /**
   * The MapSurroundInfos in layoutOptions.
   *
   * @since 5.0
   */
  mapSurroundInfos: MapSurroundInfo[];
}