package com.huyvuong.streamr.model.transport.photos.exif

import com.google.gson.annotations.SerializedName

/**
 * Response from flickr.photos.getExif.
 */
data class GetExifResponse(
        @SerializedName("photo") val exifSummary: ExifSummary,
        @SerializedName("stat") val status: String,
        @SerializedName("code") val code: Int)

data class ExifSummary(
        @SerializedName("id") val photoId: String,
        @SerializedName("camera") val camera: String,
        @SerializedName("exif") val exifEntries: List<ExifEntry>) {
    operator fun contains(tag: String): Boolean {
        return exifEntries.any { it.tag == tag }
    }

    operator fun get(tag: String): String? {
        return exifEntries.firstOrNull { it.tag == tag }?.rawContent?.content
    }
}

data class ExifEntry(
        @SerializedName("tag") val tag: String,
        @SerializedName("label") val label: String,
        @SerializedName("raw") val rawContent: ExifContent,
        @SerializedName("clean") val cleanContent: ExifContent? = null)

data class ExifContent(@SerializedName("_content") val content: String)