package com.viaccessorca.voplayerdemo.mediamgt;

import java.io.Serializable;

public class StreamingMediaItem extends MediaItem implements Serializable {

    protected String mStoredName = null;
    protected boolean mbMarlinProtected = false;
    protected boolean mbFastStartup = false;
    protected boolean mbLocalServerDemo = false;
    protected String securedHLSParam1 = null;
    protected String securedHLSParam2 = null;
    protected String securedHLSParam3 = null;
    protected String mVastUrl = null;
    protected String mVmapUrl = null;
    protected String mSecondaryContentUri = null;

    protected String dbFaasOffline;

    private String descriptionFilePath;

    // Authentec login and password
    protected String HttpAuthUsername;
    protected String HttpAuthPassword;
    // SSL
    protected String SSLCACertFilePath;
    protected String SSLCACertFileType;
    protected String SSLClientCertFilePath;
    protected String SSLClientCertFileType;
    protected String SSLClientKeyFilePath;
    protected String SSLClientKeyFileType;
    // Http Custom Header
    protected String HttpCustomHeader;

    protected int streamBitrates[] = null;

    protected String thumbnailsZipUrl;

    protected String drmAgentType = null;
    protected String drmPersonalizationUrl = null;
    protected String drmPersonalizationAppVersion = null;
    protected String drmPersonalizationCustomData = null;
    protected String drmPersonalizationCustomerID = null;
    protected String drmLicenseAcquisitionUrl = null;
    protected String drmLicenseAcquisitionUrlParameters = null;
    protected String drmLicenseAcquisitionCustomData = null;
    protected String drmLicenseAcquisitionCookie = null;

    protected String chromeCastAlternateUrl = null;
    protected String chromeCastAlternateDrmAgentType = null;
    protected String chromeCastAlternateDrmLicenserUrl = null;
    protected String chromeCastAlternateDrmCustomData = null;
    protected String chromeCastAlternateDrmCookie = null;

    protected String scrubbingOptionServer = null;
    protected String scrubbingOptionChannel = null;
    protected String scrubbingOptionAsset = null;
    protected String scrubbingOptionServiceType = null;
    protected String scrubbingOptionStart = null;
    protected String scrubbingOptionEnd = null;
    protected String scrubbingOptionSpriteResolution = null;
    protected String scrubbingOptionSpriteColums = null;
    protected String scrubbingOptionSpriteLines = null;
    protected String scrubbingOptionSpriteInterval = null;

    protected String mAbrSensitivityValue;
    protected int mLiveLatencyValue = -1;

    protected boolean mbForceMSSUpdateManifest = false;

    protected boolean m360Content = false;
    protected boolean drmUseVOSecurityGateway = false;
    protected String drmContentIdentifier = null;


    public StreamingMediaItem(String mediaId, String mediaUri, String displayName, boolean embedded) {
        super(mediaId, mediaUri, displayName);
        if (embedded) {
            this.mediaType = MediaType.HTTP_STREAMING_MEDIA_EBD;
        } else {
            this.mediaType = MediaType.HTTP_STREAMING_MEDIA;
        }
    }


    /**
     * @return the company name of the stream (VERIMATRIX SPECIFIC)
     */
    public String getCompanyName() {
        return securedHLSParam1;
    }

    /**
     * @param companyName the company name of the stream (VERIMATRIX SPECIFIC)
     */
    public void setCompanyName(String companyName) {
        this.securedHLSParam1 = companyName;
    }

    /**
     * @return the boot address of the stream (VERIMATRIX SPECIFIC)
     */
    public String getBootAddress() {
        return securedHLSParam2;
    }

    /**
     * @param bootAddress the boot address of the stream (VERIMATRIX SPECIFIC)
     */
    public void setBootAddress(String bootAddress) {
        this.securedHLSParam2 = bootAddress;
    }

    /**
     * @return the secondary content to insert
     */
    public String getSecondaryContentUri() {
        return mSecondaryContentUri;
    }

    /**
     * @param secondaryContentUri the content to insert at the beginning of the playback
     */
    public void setSecondaryContentUri(String secondaryContentUri) {
        mSecondaryContentUri = secondaryContentUri;
    }

    /**
     * @return if the stream is marlin protected
     */
    public boolean getMarlinProtected() {
        return mbMarlinProtected;
    }

    /**
     * @param bProtected true if the stream is marlin protected
     */
    public void setMarlinProtected(boolean bProtected) {
        this.mbMarlinProtected = bProtected;
    }

    /**
     * @return the name of Stream
     */
    public String getStoredName() {
        return mStoredName;
    }

    /**
     * @param name of Stream
     */
    public void setStoredName(String name) {
        mStoredName = name;
    }

    /**
     * @return the Vast Url
     */
    public String getVastUrl() {
        return mVastUrl;
    }

    /**
     * @param url the Vast Url
     */
    public void setVastUrl(String url) {
        mVastUrl = url;
    }

    /**
     * @return the Vmap Url
     */
    public String getVmapUrl() {
        return mVmapUrl;
    }

    /**
     * @param url the Vmap Url
     */
    public void setVmapUrl(String url) {
        mVmapUrl = url;
    }

    /**
     * @return if the fast startup mode is enabled
     */
    public boolean getFastStartup() {
        return mbFastStartup;
    }

    /**
     * @param bEnabled true if the local server demo mode is enabled
     */
    public void setFastStartup(boolean bEnabled) {
        this.mbFastStartup = bEnabled;
    }

    /**
     * @return if the fast startup mode is enabled
     */
    public boolean getLocalServerDemo() {
        return mbLocalServerDemo;
    }

    /**
     * @param bEnabled true if the local server demo mode is enabled
     */
    public void setLocalServerDemo(boolean bEnabled) {
        this.mbLocalServerDemo = bEnabled;
    }

    /**
     * @return the Abr Sensitivity Value (high or low)
     */
    public String getAbrSensitivityValue() {
        return this.mAbrSensitivityValue;
    }

    /**
     * @param AbrSensitivityValue sensitivity value
     */
    public void setAbrSensitivityValue(String AbrSensitivityValue) {
        this.mAbrSensitivityValue = AbrSensitivityValue;
    }

    /**
     * @return the live latency Value
     */
    public int getLiveLatencyValue() {
        return this.mLiveLatencyValue;
    }

    /**
     * @param LiveLatencyValue value of chunk latency
     */
    public void setLiveLatencyValue(int LiveLatencyValue) {
        this.mLiveLatencyValue = LiveLatencyValue;
    }

    /**
     * @return ForceMSSUpdateManifest Value
     */
    public boolean isForceMSSUpdateManifest() {
        return this.mbForceMSSUpdateManifest;
    }

    /**
     * @param ForceMSSUpdateManifest value
     */
    public void setForceMSSUpdateManifest(boolean ForceMSSUpdateManifest) {
        this.mbForceMSSUpdateManifest = ForceMSSUpdateManifest;
    }

    /**
     * @return the db Faas Offline path
     */
    public String getDbFaasOffline() {
        return dbFaasOffline;
    }

    /**
     * @param dbFaasOffline the path of db faas offline
     */
    public void setDbFaasOffline(String dbFaasOffline) {
        this.dbFaasOffline = dbFaasOffline;
    }

    /**
     * @return the descriptionFilePath
     */
    public String getDescriptionFilePath() {
        return descriptionFilePath;
    }

    /**
     * @param descriptionFilePath the descriptionFilePath to set
     */
    public void setDescriptionFilePath(String descriptionFilePath) {
        this.descriptionFilePath = descriptionFilePath;
    }

    /**
     * @param HttpAuthUsername Http Auth Username to be set for this media
     */
    public void setHttpAuthUsername(String HttpAuthUsername) {
        this.HttpAuthUsername = HttpAuthUsername;
    }

    /**
     * @return Http Auth Username to be set for this media
     */
    public String getHttpAuthUsername() {
        return this.HttpAuthUsername;
    }

    /**
     * @param HttpAuthPassword Http Auth Password to be set for this media
     */
    public void setHttpAuthPassword(String HttpAuthPassword) {
        this.HttpAuthPassword = HttpAuthPassword;
    }

    /**
     * @return Http Auth Password to be set for this media
     */
    public String getHttpAuthPassword() {
        return this.HttpAuthPassword;
    }

    /**
     * @param SSLCACertFilePath SSL CA Cert file path to be set for this media
     */
    public void setSSLCACertFilePath(String SSLCACertFilePath) {
        this.SSLCACertFilePath = SSLCACertFilePath;
    }

    /**
     * @return SSL CA Cert file path to be set for this media
     */
    public String getSSLCACertFilePath() {
        return this.SSLCACertFilePath;
    }

    /**
     * @param SSLCACertFileType SSL CA Cert file type to be set for this media
     */
    public void setSSLCACertFileType(String SSLCACertFileType) {
        this.SSLCACertFileType = SSLCACertFileType;
    }

    /**
     * @return SSL CA Cert file type to be set for this media
     */
    public String getSSLCACertFileType() {
        return this.SSLCACertFileType;
    }

    /**
     * @param SSLClientCertFilePath SSL Client Cert file path to be set for this media
     */
    public void setSSLClientCertFilePath(String SSLClientCertFilePath) {
        this.SSLClientCertFilePath = SSLClientCertFilePath;
    }

    /**
     * @return SSL Client Cert file path to be set for this media
     */
    public String getSSLClientCertFilePath() {
        return this.SSLClientCertFilePath;
    }

    /**
     * @param SSLClientCertFileType SSL Client Cert file type to be set for this media
     */
    public void setSSLClientCertFileType(String SSLClientCertFileType) {
        this.SSLClientCertFileType = SSLClientCertFileType;
    }

    /**
     * @return SSL Client Cert file type to be set for this media
     */
    public String getSSLClientCertFileType() {
        return this.SSLClientCertFileType;
    }

    /**
     * @param SSLClientKeyFilePath SSL Client Key file path to be set for this media
     */
    public void setSSLClientKeyFilePath(String SSLClientKeyFilePath) {
        this.SSLClientKeyFilePath = SSLClientKeyFilePath;
    }

    /**
     * @return SSL Client Key file path to be set for this media
     */
    public String getSSLClientKeyFilePath() {
        return this.SSLClientKeyFilePath;
    }

    /**
     * @param SSLClientKeyFileType SSL Client Key file type to be set for this media
     */
    public void setSSLClientKeyFileType(String SSLClientKeyFileType) {
        this.SSLClientKeyFileType = SSLClientKeyFileType;
    }

    /**
     * @return SSL Client Key file type to be set for this media
     */
    public String getSSLClientKeyFileType() {
        return this.SSLClientKeyFileType;
    }

    /**
     * @param HttpCustomHeader Http Custom Header to be set for this media
     */
    public void setHttpCustomHeader(String HttpCustomHeader) {
        this.HttpCustomHeader = HttpCustomHeader;
    }

    /**
     * @return Http Custom Header to be set for this media
     */
    public String getHttpCustomHeader() {
        return this.HttpCustomHeader;
    }

    public int[] getStreamBitrates() {
        return streamBitrates;
    }

    public void setStreamBitrates(int[] streamBitrates) {
        this.streamBitrates = streamBitrates;
    }

    public String getThumbnailsZipUrl() {
        return thumbnailsZipUrl;
    }

    public void setThumbnailsZipUrl(String remoteThumbnailsZipUrl) {
        this.thumbnailsZipUrl = remoteThumbnailsZipUrl;
    }

    public String getDRMLicenseAcquisitionUrl() {
        return drmLicenseAcquisitionUrl;
    }

    public void setDRMLicenseAcquisitionUrl(String drmLicenseAcquisitionUrl) {
        this.drmLicenseAcquisitionUrl = drmLicenseAcquisitionUrl;
    }

    public String getDRMLicenseAcquisitionUrlParameters() {
        return drmLicenseAcquisitionUrlParameters;
    }

    public void setDRMLicenseAcquisitionUrlParameters(String drmLicenseAcquisitionUrlParameters) {
        this.drmLicenseAcquisitionUrlParameters = drmLicenseAcquisitionUrlParameters;
    }

    public String getDRMLicenseAcquisitionCustomData() {
        return drmLicenseAcquisitionCustomData;
    }

    public void setDRMLicenseAcquisitionCustomData(String drmLicenseAcquisitionCustomData) {
        this.drmLicenseAcquisitionCustomData = drmLicenseAcquisitionCustomData;
    }

    public String getDRMLicenseAcquisitionCookie() {
        return drmLicenseAcquisitionCookie;
    }

    public void setDRMLicenseAcquisitionCookie(String drmLicenseAcquisitionCookie) {
        this.drmLicenseAcquisitionCookie = drmLicenseAcquisitionCookie;
    }

    public String getDrmAgentType() {
        return drmAgentType;
    }

    public void setDrmAgentType(String drmAgentType) {
        this.drmAgentType = drmAgentType;
    }

    public String getDrmPersonalizationUrl() {
        return drmPersonalizationUrl;
    }

    public void setDrmPersonalizationUrl(String drmPersonalizationUrl) {
        this.drmPersonalizationUrl = drmPersonalizationUrl;
    }

    public String getDrmPersonalizationAppVersion() {
        return drmPersonalizationAppVersion;
    }

    public void setDrmPersonalizationAppVersion(String drmPersonalizationAppVersion) {
        this.drmPersonalizationAppVersion = drmPersonalizationAppVersion;
    }

    public String getDrmPersonalizationCustomData() {
        return drmPersonalizationCustomData;
    }

    public void setDrmPersonalizationCustomData(String drmPersonalizationCustomData) {
        this.drmPersonalizationCustomData = drmPersonalizationCustomData;
    }

    public String getDrmPersonalizationCustomerID() {
        return drmPersonalizationCustomerID;
    }

    public void setDrmPersonalizationCustomerID(String drmPersonalizationCustomerID) {
        this.drmPersonalizationCustomerID = drmPersonalizationCustomerID;
    }

    public void setChromeCastAlternateUrl(String chromeCastAlternateUrl) {
        this.chromeCastAlternateUrl = chromeCastAlternateUrl;
    }

    public String getChromeCastAlternateUrl() {
        return this.chromeCastAlternateUrl;
    }

    public void setChromeCastAlternateDrmAgentType(String chromeCastAlternateDrmAgentType) {
        this.chromeCastAlternateDrmAgentType = chromeCastAlternateDrmAgentType;
    }

    public String getChromeCastAlternateDrmAgentType() {
        return this.chromeCastAlternateDrmAgentType;
    }

    public void setChromeCastAlternateDrmLicenserUrl(String chromeCastAlternateDrmLicenserUrl) {
        this.chromeCastAlternateDrmLicenserUrl = chromeCastAlternateDrmLicenserUrl;
    }

    public String getChromeCastAlternateDrmLicenserUrl() {
        return this.chromeCastAlternateDrmLicenserUrl;
    }

    public void setChromeCastAlternateDrmCustomData(String chromeCastAlternateDrmCustomData) {
        this.chromeCastAlternateDrmCustomData = chromeCastAlternateDrmCustomData;
    }

    public String getChromeCastAlternateDrmCustomData() {
        return this.chromeCastAlternateDrmCustomData;
    }

    public void setChromeCastAlternateDrmCookie(String chromeCastAlternateDrmCookie) {
        this.chromeCastAlternateDrmCookie = chromeCastAlternateDrmCookie;
    }

    public String getChromeCastAlternateDrmCookie() {
        return this.chromeCastAlternateDrmCookie;
    }

    /**
     * @param scrubbingOptionServer
     */
    public void setScrubbingOptionServer(String scrubbingOptionServer) {
        this.scrubbingOptionServer = scrubbingOptionServer;
    }

    public String getScrubbingOptionServer() {
        return this.scrubbingOptionServer;
    }

    /**
     * @param scrubbingOptionChannel
     */
    public void setScrubbingOptionChannel(String scrubbingOptionChannel) {
        this.scrubbingOptionChannel = scrubbingOptionChannel;
    }

    public String getScrubbingOptionChannel() {
        return this.scrubbingOptionChannel;
    }

    /**
     * @param scrubbingOptionAsset
     */
    public void setScrubbingOptionAsset(String scrubbingOptionAsset) {
        this.scrubbingOptionAsset = scrubbingOptionAsset;
    }

    public String getScrubbingOptionAsset() {
        return this.scrubbingOptionAsset;
    }

    /**
     * @param scrubbingOptionServiceType
     */
    public void setScrubbingOptionServiceType(String scrubbingOptionServiceType) {
        this.scrubbingOptionServiceType = scrubbingOptionServiceType;
    }

    public String getScrubbingOptionServiceType() {
        return this.scrubbingOptionServiceType;
    }

    /**
     * @param scrubbingOptionStart
     */
    public void setScrubbingOptionStart(String scrubbingOptionStart) {
        this.scrubbingOptionStart = scrubbingOptionStart;
    }

    public String getScrubbingOptionStart() {
        return this.scrubbingOptionStart;
    }

    /**
     * @param scrubbingOptionEnd
     */
    public void setScrubbingOptionEnd(String scrubbingOptionEnd) {
        this.scrubbingOptionEnd = scrubbingOptionEnd;
    }

    public String getScrubbingOptionEnd() {
        return this.scrubbingOptionEnd;
    }

    /**
     * @param scrubbingOptionSpriteResolution
     */
    public void setScrubbingOptionSpriteResolution(String scrubbingOptionSpriteResolution) {
        this.scrubbingOptionSpriteResolution = scrubbingOptionSpriteResolution;
    }

    public String getScrubbingOptionSpriteResolution() {
        return this.scrubbingOptionSpriteResolution;
    }

    /**
     * @param scrubbingOptionSpriteColums
     */
    public void setScrubbingOptionSpriteColums(String scrubbingOptionSpriteColums) {
        this.scrubbingOptionSpriteColums = scrubbingOptionSpriteColums;
    }

    public String getScrubbingOptionSpriteColums() {
        return this.scrubbingOptionSpriteColums;
    }

    /**
     * @param scrubbingOptionSpriteLines
     */
    public void setScrubbingOptionSpriteLines(String scrubbingOptionSpriteLines) {
        this.scrubbingOptionSpriteLines = scrubbingOptionSpriteLines;
    }

    public String getScrubbingOptionSpriteLines() {
        return this.scrubbingOptionSpriteLines;
    }

    /**
     * @param scrubbingOptionSpriteInterval
     */
    public void setScrubbingOptionSpriteInterval(String scrubbingOptionSpriteInterval) {
        this.scrubbingOptionSpriteInterval = scrubbingOptionSpriteInterval;
    }

    public String getScrubbingOptionSpriteInterval() {
        return this.scrubbingOptionSpriteInterval;
    }


    public boolean get360Content() {
        return m360Content;
    }

    public void set360Content(boolean b360Content) {
        m360Content = b360Content;
    }

    @Override
    public int compareTo(MediaItem another) {

        switch (another.mediaType) {

            case MEDIA_PLAYLIST:
                if (MediaType.HTTP_STREAMING_MEDIA_EBD == this.mediaType) {
                    return -1;
                } else {
                    return 1;
                }

            case HTTP_STREAMING_MEDIA:
                if (MediaType.HTTP_STREAMING_MEDIA_EBD == this.mediaType) {
                    return -1;
                } else {
                    return this.displayName.compareToIgnoreCase(another.displayName);
                }

            case HTTP_STREAMING_MEDIA_EBD:
                if (MediaType.HTTP_STREAMING_MEDIA_EBD == this.mediaType) {
                    return this.displayName.compareToIgnoreCase(another.displayName);
                } else {
                    return 1;
                }

            case SUBTITLE_FILE:
            case LOCAL_MEDIA:
            case UNKNOWN:
            default:
                return 1;
        }
    }

    public String toString() {
        String buffer = new String("StreamingMediaItem: [" +
                "Uri: " + mediaUri + ", " +
                "Emb: " + (this.mediaType == MediaType.HTTP_STREAMING_MEDIA_EBD) + ", " +
                "..." +
                "]");
        return buffer;
    }

    /**
     * @return whether to use VOSecurityGateway or not
     */
    public boolean useVOSecurityGateway() {
        return this.drmUseVOSecurityGateway;
    }

    public void setDrmUseVOSecurityGateway(boolean storedDrmUseVOSecurityGateway) {
        this.drmUseVOSecurityGateway = storedDrmUseVOSecurityGateway;
    }

    /**
     * @return The Drm content Identifier value
     */
    public String getDrmContentIdentifier() {
        return this.drmContentIdentifier;
    }

    public void setDrmContentIdentifier(String storedDrmContentIdentifier) {
        this.drmContentIdentifier = storedDrmContentIdentifier;
    }
}
