package com.tumblr.jumblr.types;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * This class represents a post of type "video"
 * @author jc
 */
public class VideoPost extends Post {

    private List<Video> player;
    private String caption;
    private String embed;
    private File data;

    /**
     * Get the videos from this post
     * @return the videos
     */
    public List<Video> getVideos() {
        return this.player;
    }

    /**
     * Get the caption from this post
     * @return String caption
     */
    public String getCaption() {
        return caption;
    }

    /**
     * Set the embed code for this post
     * @param embed the Embed HTML for this post
     * @throws IllegalArgumentException if data is already set
     */
    public void setEmbedCode(String embed) {
        if (data != null) {
            throw new IllegalArgumentException("Cannot supply both data & embed");
        }
        this.embed = embed;
    }

    /**
     * Set the data for this post
     * @param file the file to read from
     * @throws IllegalArgumentException source is already set
     */
    public void setData(File file) {
        if (embed != null) {
            throw new IllegalArgumentException("Cannot supply both embed & data");
        }
        this.data = file;
    }

    /**
     * Set the caption for this post
     * @param caption the caption to set
     */
    public void setCaption(String caption) {
        this.caption = caption;
    }

    /**
     * Get the details for this post (in addition to the base details)
     * @return details of this post
     */
    @Override
    public Map<String, Object> detail() {
        Map<String, Object> details = super.detail();
        details.put("caption", caption);
        details.put("embed", embed);
        details.put("data", data);
        details.put("type", "video");
        return details;
    }

}

@@ -311,16 +311,612 @@
 le data;
+%0A    private String thumbnail_url;%0A    private int thumbnail_width;%0A    private int thumbnail_height;%0A%0A    /**%0A     * Get the thumbnail URL for the video%0A     * @return possibly null URL%0A     */%0A    public String getThumbnailUrl() %7B%0A        return thumbnail_url;%0A    %7D%0A%0A    /**%0A     * Get the thumbnail URL for the video%0A     * @return 0 if not set%0A     */%0A    public int getThumbnailWidth() %7B%0A        return thumbnail_width;%0A    %7D%0A%0A    /**%0A     * Get the thumbnail URL for the video%0A     * @return 0 if not set%0A     */%0A    public int getThumbnailHeight() %7B%0A        return thumbnail_height;%0A    %7D
 %0A%0A    /*

Add thumbnail info to VideoPost objects