/**
 * Primitive types for contracts
 * 
 * Reusable type definitions that can be used across all contracts.
 */

/**
 * Represents any JSON-serializable value
 */
export type JsonValue = 
  | string 
  | number 
  | boolean 
  | null 
  | JsonValue[] 
  | { [key: string]: JsonValue };

/**
 * Represents a JSON-serializable object (not array)
 */
export type JsonObject = {
  [key: string]: JsonValue;
};

/**
 * Represents a JSON-serializable array
 */
export type JsonArray = JsonValue[];

/**
 * Helper type to ensure a type is JSON-serializable
 * 
 * Usage:
 * ```typescript
 * type MyData = JsonSerializable<{
 *   title: string;
 *   count: number;
 *   items: string[];
 * }>;
 * ```
 */
export type JsonSerializable<T> = {
  [K in keyof T]: T[K] extends JsonValue ? T[K] : never;
};