package com.bayer.edam.migration.mam;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * Representation of /rest/migration/entry
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class Entry {

	public static class Type {
		public Long id;
		public Map<String, String> name;
	}

	public static class Copyright {
		public String use;
		public String time;
		public String regionalLicenseComment;
		public String personalLicenseComment;
		public String validFrom;
		public String validTo;
		public Map<String, String> organization;
		public Boolean releasedForJournalists;
		public Boolean usageInternal;
		public Boolean usageExternal;
		public Boolean usagePrint;
		public Boolean usageOnline;
		public Boolean usageAudio;
		public Boolean usageVideo;
		public Boolean regionalLicense;
		public Boolean personalLicense;

	}
	
	public static class Gpc {
		public Long id;
		public Map<String, String> owner;
		public String gpcState;
		public String gpcNumber;
		public Date expirationDate;
		public String lastNotification;
		public Integer gpcStateId;
	}

	@JsonIgnoreProperties(ignoreUnknown = true)
	public static class Download {
		public Long id;
		public String href;
		public String mimeType;
		public Integer contentSuperTypeId;
		public Long size;
		public String entryFileVariation;
		public String watermarkVariation;
		public Map<String, String> description;
		public String fileName;
		public String fileNameOnDisc;
	}

	public Long id;
	public String href;
	public Long fileSize;
	public String fileName;
	public String internalKey;
	public Date creationDate;
	public Date uploadDate;
	public Map<String, String> name;
	public Map<String, String> keyword;
	public Map<String, String> description;
	public Map<String, String> comment;
	public Map<String, String> user;
	public Map<String, String> uploader;
	public Map<String, String> indexer;
	public Double ratingValue;
	public Map<String, String> release; // ??
	public String brandingNet;
	public Type mediaType;
	public Copyright copyright;
	public String master;
	public Map<String, String> project;
	public Type imageType;
	public Gpc gpc;
	public String mediaAssistantId;
	public Map<String, String> metaData;
	public List<Integer> categories;
	public Integer stateId;
	public Integer contentSuperTypeId;
	public List<Download> downloadList;
	public List<Download> downloadListPublicFolder;

	@Override
	public String toString() {
		return "Entry{" + "id=" + id + ", name=" + name.get("en") + ", creationDate=" + creationDate + ", user="
				+ user.get("id") + ", copyright.organization.id=" + copyright.organization.get("id") + '}';
	}

//	public String toFullString() {
//		StringBuilder result = new StringBuilder();
//		String newLine = System.getProperty("line.separator");
//
//		result.append(this.getClass().getName());
//		result.append(" Object {");
//		result.append(newLine);
//
//		// determine fields declared in this class only (no fields of superclass)
//		Field[] fields = this.getClass().getDeclaredFields();
//
//		// print field names paired with their values
//		for (Field field : fields) {
//			result.append("  ");
//			try {
//				result.append(field.getName());
//				result.append(": ");
//				// requires access to private field:
//				result.append(field.get(this));
//			} catch (IllegalAccessException ex) {
//				log.error(ex.toString());
//			}
//			result.append(newLine);
//		}
//		result.append("}");
//
//		return result.toString();
//	}

}
