export type DrawingAreaShape = 'rect' | 'ellipse' | 'triangle' | 'star' | 'svg';

export type DrawingAreaId = string;

export type DrawingAreaRect = {
  x: number;
  y: number;
  width: number;
  height: number;
};

export type DrawingAreaEmptyVisual =
  | { kind: 'image'; src: string; opacity?: number; fit?: 'contain' | 'cover' }
  | { kind: 'text'; text: string; opacity?: number }
  | { kind: 'shape'; shape: 'rect' | 'circle'; opacity?: number };

export type DrawingAreaPolicy = {
  constraints?: {
    mode?: 'hard' | 'soft';
    containment?: 'area' | 'canvas';
    /** Defaults to true: user objects may partially exceed the area unless explicitly set to false. */
    allowOverflow?: boolean;
    /** Defaults to true: newly added user layers are fitted inside the drawing area unless explicitly set to false. */
    autoFit?: boolean;
  };

  allowed?: {
    objectKinds?: string[];
  };

  snapping?: {
    enabled?: boolean;
    rules?: string[];
    strength?: number;
    thresholdPx?: number;
  };

  clipping?: {
    /** Defaults to true: drawing areas clip their assigned objects unless explicitly disabled. */
    enabled?: boolean;
    type?: 'rect' | 'path';
    inset?: { top: number; right: number; bottom: number; left: number };
  };

  bleed?: { top: number; right: number; bottom: number; left: number };
  margin?: { top: number; right: number; bottom: number; left: number };

  pricing?: {
    scope?: 'area' | 'objects' | 'both';
    base?: number;
    multiplier?: number;
    rules?: Array<{ id: string; kind: string; params: any }>;
  };

  capacity?: {
    maxObjects?: number;
    overflowStrategy?: 'replaceOldest' | 'reject';
    emptyVisual?: DrawingAreaEmptyVisual;
  };
};
