package com.libreecm.commonAPI.model.objects;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.libreecm.commonAPI.model.enums.Cardinality;
import com.libreecm.commonAPI.model.enums.MimeType;
import com.libreecm.commonAPI.model.enums.PropertyIds;
import com.libreecm.commonAPI.model.enums.PropertyType;
import com.libreecm.commonAPI.model.enums.Updatability;
import com.libreecm.commonAPI.model.objects.properties.PropertyIntegerDefinitionImpl;
import com.libreecm.commonAPI.model.objects.properties.PropertyStringDefinitionImpl;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
/**
 * RenditionData implementation.
 */
public class RenditionData extends LibreECMDataObject {

    private static final long serialVersionUID = 1L;

    private BigInteger height;
    private String kind;
    private BigInteger length;
    private String mimeType;
    private String renditionDocumentId;
    private String streamId;
    private String title;
    private BigInteger width;

    public RenditionData() {
    	super();
    	            	
    }

    public RenditionData(String streamId, String mimeType, BigInteger length, String kind, String title,
            BigInteger width, BigInteger height, String renditionDocumentId) {
        super();
    	this.setStreamId(streamId);
        this.setMimeType(mimeType);
        this.setBigLength(length);
        this.setKind(kind);
        this.setTitle(title);
        this.setBigWidth(width);
        this.setBigHeight(height);
        this.setRenditionDocumentId(renditionDocumentId);
    }
    

	public RenditionData(Uri uri, ObjectType objectType){
		super(uri, objectType);
	}

    public BigInteger getBigHeight() {
        return height;
    }

    public BigInteger getBigLength() {
        return length;
    }

    public BigInteger getBigWidth() {
        return width;
    }

    public String getKind() {
        return kind;
    }

    public String getMimeType() {
        return mimeType;
    }

    public String getRenditionDocumentId() {
        return renditionDocumentId;
    }

    public String getStreamId() {
        return streamId;
    }

    public String getTitle() {
        return title;
    }

    public void setBigHeight(BigInteger height) {
    	if (height==null) return;
    	addIntegerProperty("cmis:height",height);
		this.height = height;
    }

    public void setBigLength(BigInteger length) {
    	if (length==null) return;
    	addIntegerProperty("cmis:length",length);
		this.length = length;
    }

    public void setBigWidth(BigInteger width) {
    	if (width==null) return;
    	addIntegerProperty("cmis:width",width);
		this.width = width;
    }

    public void setKind(String kind) {
    	if (kind==null) return;
    	addStringProperty("cmis:kind",kind);
		this.kind = kind;
    }

    public void setMimeType(String mimeType) {
    	if (mimeType==null) return;
    	addStringProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE,mimeType);
		this.mimeType = mimeType;
    }

    public void setRenditionDocumentId(String renditionDocumentId) {
    	if (renditionDocumentId==null) return;
    	addStringProperty("cmis:renditionDocumentId",renditionDocumentId);
		this.renditionDocumentId = renditionDocumentId;
    }

    public void setStreamId(String streamId) {
    	if (streamId==null) return;
    	addStringProperty("ccc",streamId);
		this.streamId = streamId;
    }

    public void setTitle(String title) {
    	if (title==null) return;
		addStringProperty("cmis:title",title);
		this.title = title;
    }

    public String toString() {
        return "RenditionDataImpl [, kind=" + kind + ", title=" + title + ", MIME type=" + mimeType + ", length="
                + length + ", rendition document id=" + renditionDocumentId + ", stream id=" + streamId + " height="
                + height + ", width=" + width + "]" + super.toString();
    }
}
