|
| 1 | +/** |
| 2 | + * Represents the type of media content |
| 3 | + * @example |
| 4 | + * const type: ResultType = 'image' |
| 5 | + * const type: ResultType = 'video' |
| 6 | + */ |
1 | 7 | export type ResultType = 'image' | 'video'
|
2 | 8 |
|
| 9 | +/** |
| 10 | + * Base interface containing common properties for media results. |
| 11 | + * Used as a foundation for more specific result types. |
| 12 | + * |
| 13 | + * @example |
| 14 | + * const baseResult: BaseResult = { |
| 15 | + * path: '/path/to/media/file.jpg', |
| 16 | + * type: 'image', |
| 17 | + * width: 1920, |
| 18 | + * height: 1080, |
| 19 | + * fileName: 'file.jpg' |
| 20 | + * } |
| 21 | + */ |
3 | 22 | export interface BaseResult {
|
| 23 | + /** |
| 24 | + * File path of the media asset |
| 25 | + * Can be relative or absolute depending on context |
| 26 | + */ |
4 | 27 | path: string
|
5 | 28 |
|
| 29 | + /** |
| 30 | + * Type of media content |
| 31 | + * Used to determine how the asset should be handled |
| 32 | + */ |
6 | 33 | type: ResultType
|
7 | 34 |
|
| 35 | + /** |
| 36 | + * Width of the media in pixels |
| 37 | + * Optional in base result as it may not be immediately available |
| 38 | + */ |
8 | 39 | width?: number
|
9 | 40 |
|
| 41 | + /** |
| 42 | + * Height of the media in pixels |
| 43 | + * Optional in base result as it may not be immediately available |
| 44 | + */ |
10 | 45 | height?: number
|
11 | 46 |
|
| 47 | + /** |
| 48 | + * Duration of the media in seconds |
| 49 | + * Only applicable for video content |
| 50 | + * @example 120.5 // 2 minutes and 30 seconds |
| 51 | + */ |
12 | 52 | duration?: number
|
13 | 53 |
|
| 54 | + /** |
| 55 | + * Path to a thumbnail image representation |
| 56 | + * Useful for previews and grid displays |
| 57 | + * Can be a local path or URL depending on implementation |
| 58 | + */ |
14 | 59 | thumbnail?: string
|
15 | 60 |
|
| 61 | + /** |
| 62 | + * Original filename of the media asset |
| 63 | + * Includes the file extension |
| 64 | + * @example "IMG_20240301_123456.jpg" |
| 65 | + */ |
16 | 66 | fileName?: string
|
17 | 67 | }
|
18 | 68 |
|
| 69 | +/** |
| 70 | + * Extended result interface with complete metadata and file information. |
| 71 | + * Used for fully processed media assets where all properties are known. |
| 72 | + * |
| 73 | + * @extends BaseResult |
| 74 | + * |
| 75 | + * @example |
| 76 | + * const result: Result = { |
| 77 | + * path: '/path/to/media/file.jpg', |
| 78 | + * type: 'image', |
| 79 | + * width: 1920, |
| 80 | + * height: 1080, |
| 81 | + * fileName: 'file.jpg', |
| 82 | + * localIdentifier: 'unique-id-123', |
| 83 | + * mime: 'image/jpeg', |
| 84 | + * size: 1024000, |
| 85 | + * creationDate: 1709312436000 |
| 86 | + * } |
| 87 | + */ |
19 | 88 | export interface Result extends BaseResult {
|
| 89 | + /** |
| 90 | + * Unique identifier for the media asset |
| 91 | + * Used for local database tracking and reference |
| 92 | + * Format may vary depending on platform/implementation |
| 93 | + */ |
20 | 94 | localIdentifier: string
|
| 95 | + |
| 96 | + /** |
| 97 | + * Width of the media in pixels |
| 98 | + * Required in Result interface as it should be known after processing |
| 99 | + */ |
21 | 100 | width: number
|
| 101 | + |
| 102 | + /** |
| 103 | + * Height of the media in pixels |
| 104 | + * Required in Result interface as it should be known after processing |
| 105 | + */ |
22 | 106 | height: number
|
| 107 | + |
| 108 | + /** |
| 109 | + * MIME type of the media file |
| 110 | + * @example "image/jpeg", "video/mp4" |
| 111 | + */ |
23 | 112 | mime: string
|
| 113 | + |
| 114 | + /** |
| 115 | + * File size in bytes |
| 116 | + * @example 1024000 // 1MB |
| 117 | + */ |
24 | 118 | size: number
|
| 119 | + |
| 120 | + /** |
| 121 | + * Optional identifier for storage bucket |
| 122 | + * Used when assets are stored in cloud storage systems |
| 123 | + * @platform android |
| 124 | + */ |
25 | 125 | bucketId?: number
|
| 126 | + |
| 127 | + /** |
| 128 | + * Actual file path on the system |
| 129 | + * May differ from the `path` property in cases where |
| 130 | + * the file is stored in a different location than referenced |
| 131 | + * @platform android |
| 132 | + */ |
26 | 133 | realPath?: string
|
| 134 | + |
| 135 | + /** |
| 136 | + * Name of the containing folder |
| 137 | + * Useful for organization and grouping |
| 138 | + * @platform android |
| 139 | + */ |
27 | 140 | parentFolderName?: string
|
| 141 | + |
| 142 | + /** |
| 143 | + * Unix timestamp in milliseconds of when the media was created |
| 144 | + * @example 1709312436000 // March 1, 2024 12:34:56 PM |
| 145 | + */ |
28 | 146 | creationDate?: number
|
| 147 | + |
| 148 | + /** |
| 149 | + * Indicates if the media has been cropped from its original dimensions |
| 150 | + * Used to track image modifications |
| 151 | + */ |
29 | 152 | crop?: boolean
|
30 | 153 | }
|
0 commit comments