export enum MediaType {
  IMAGE = 'IMAGE',
  FILE = 'FILE',
  AUDIO = 'AUDIO',
  VIDEO = 'VIDEO',
  GIF = 'GIF',
}

export type MediaStatus =
  | 'idle'
  | 'uploading'
  | 'creatingAsset'
  | 'uploaded'
  | 'failed';

/**
 * Mobile "Media" entity
 */
export type MediaEntity = {
  id: string;
  type: MediaType;
  fileAsset: Nullable<FileAsset>;
  status: MediaStatus;
  /**
   * The content type of the asset
   */
  contentType: string;
  /**
   * The local uri of the asset
   */
  localUri: string;
  /**
   * The name of the file
   */
  name: string;
  /**
   * The height of the image
   */
  height?: number;
  /**
   * The width of the image
   */
  width?: number;
  /**
   * The size of the asset in bytes
   */
  sizeInBytes: number;
  metadata?: {
    durationInMs?: number; // For audio/video files
  };
  /**
   * Content hash used for deduplication and compression caching
   */
  hash?: string;
};

/**
 * Media entity for the file-assets service
 */
export type FileAsset = {
  contentType: string;
  createdAt: string;
  externalReference?: {
    id: string;
    origin: 'GIPHY' | 'PUBLIC_URL';
  };
  height?: number;
  id: number;
  key: string;
  name: string;
  size: string;
  thumbnailUrl: string | null;
  type: MediaType;
  updatedAt: string;
  uploadUrl: string;
  url: string;
  width?: number;
  public?: boolean;
  metadata?: {
    durationInMs?: number; // For audio/video files
  };
};
