// src/types/exif-parser.d.ts

/**
 * This declaration file provides a basic module definition for 'exif-parser',
 * which does not ship with its own TypeScript types. This allows TypeScript
 * to recognize it as a module and avoids "implicit any" errors.
 */
declare module 'exif-parser' {
  /**
   * Represents the size of the image.
   */
  export interface ImageSize {
    width: number;
    height: number;
  }

  /**
   * Represents thumbnail data if available.
   */
  export interface Thumbnail {
    format: string;
    width: number;
    height: number;
    offset: number;
    size: number;
    buffer: Buffer;
  }

  /**
   * Represents GPS information if available.
   */
  export interface GPS {
    latitude: number;
    longitude: number;
    altitude: number;
    latitudeRef: string;
    longitudeRef: string;
    altitudeRef: number;
    GPSDateStamp: string;
    GPSTimeStamp: number[]; // [hour, minute, second]
  }

  /**
   * Represents the parsed EXIF data structure.
   * This includes common tags and derived properties.
   */
  export interface ExifData {
    /**
     * A dictionary of raw EXIF tags. Keys are tag names (e.g., 'Make', 'Model', 'DateTimeOriginal').
     * Values can be of various types (string, number, Date, etc.).
     */
    tags: {
      Make?: string;
      Model?: string;
      Orientation?: number;
      XResolution?: number;
      YResolution?: number;
      ResolutionUnit?: number;
      DateTimeOriginal?: Date; // Parsed into a Date object
      DateTimeDigitized?: Date;
      ExposureTime?: number;
      FNumber?: number;
      ISOSpeedRatings?: number;
      ShutterSpeedValue?: number;
      ApertureValue?: number;
      BrightnessValue?: number;
      ExposureBiasValue?: number;
      MaxApertureValue?: number;
      MeteringMode?: number;
      LightSource?: number;
      Flash?: number;
      FocalLength?: number;
      ColorSpace?: number;
      ExifImageWidth?: number;
      ExifImageHeight?: number;
      ExposureMode?: number;
      WhiteBalance?: number;
      DigitalZoomRatio?: number;
      FocalLengthIn35mmFilm?: number;
      SceneCaptureType?: number;
      GainControl?: number;
      Contrast?: number;
      Saturation?: number;
      Sharpness?: number;
      SubjectDistanceRange?: number;
      GPSVersionID?: number[];
      GPSLatitudeRef?: string;
      GPSLatitude?: number[];
      GPSLongitudeRef?: string;
      GPSLongitude?: number[];
      GPSAltitudeRef?: number;
      GPSAltitude?: number;
      GPSTimeStamp?: number[];
      GPSDateStamp?: string;
      [key: string]: any; // Allow for other, less common tags
    };
    imageSize: ImageSize;
    thumbnail?: Thumbnail;
    gps?: GPS;
  }

  export class ExifParser {
    static create(buffer: Buffer): ExifParser;
    parse(): ExifData;
  }

  export default ExifParser;
}