package com.vimeo.networking.model;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

/**
 * Created by hanssena on 4/23/15.
 */
public class Privacy implements Serializable {

    private static final long serialVersionUID = -1679908652622815871L;
    private static final String PRIVACY_NOBODY = "nobody";
    private static final String PRIVACY_USERS = "users";
    private static final String PRIVACY_ANYBODY = "anybody";
    private static final String PRIVACY_VOD = "ptv";
    private static final String PRIVACY_CONTACTS = "contacts";
    private static final String PRIVACY_PASSWORD = "password";
    private static final String PRIVACY_DISABLE = "disable";

    public enum PrivacyValue {
        @SerializedName(PRIVACY_NOBODY)
        NOBODY,
        @SerializedName(PRIVACY_USERS)
        USERS,
        @SerializedName(PRIVACY_ANYBODY)
        ANYBODY,
        @SerializedName(PRIVACY_VOD)
        VOD, // "ptv"
        @SerializedName(PRIVACY_CONTACTS)
        CONTACTS,
        @SerializedName(PRIVACY_PASSWORD)
        PASSWORD,
        @SerializedName(PRIVACY_DISABLE)
        DISABLE
    }

    public PrivacyValue view;
    public String embed;
    public boolean download;
    public boolean add;
    public String comments;

    static public String privacyStringFromValue(PrivacyValue value) {
        String privacyString = null;

        switch (value) {
            case NOBODY:
                privacyString = PRIVACY_NOBODY;
                break;

            case USERS:
                privacyString = PRIVACY_USERS;
                break;

            case VOD:
                privacyString = PRIVACY_VOD;
                break;

            case CONTACTS:
                privacyString = PRIVACY_CONTACTS;
                break;

            case PASSWORD:
                privacyString = PRIVACY_PASSWORD;
                break;

            case DISABLE:
                privacyString = PRIVACY_DISABLE;
                break;

            case ANYBODY:
            default:
                privacyString = PRIVACY_ANYBODY;
                break;
        }

        return privacyString;
    }

    static public PrivacyValue privacyValueFromString(final String string) {
        PrivacyValue privacyValue = PrivacyValue.ANYBODY;
        switch (string) {
            case PRIVACY_NOBODY:
                privacyValue = PrivacyValue.NOBODY;
                break;
            case PRIVACY_USERS:
                privacyValue = PrivacyValue.USERS;
                break;
            case PRIVACY_ANYBODY:
                privacyValue = PrivacyValue.ANYBODY;
                break;
            case PRIVACY_VOD:
                privacyValue = PrivacyValue.VOD;
                break;
            case PRIVACY_CONTACTS:
                privacyValue = PrivacyValue.CONTACTS;
                break;
            case PRIVACY_PASSWORD:
                privacyValue = PrivacyValue.PASSWORD;
                break;
            case PRIVACY_DISABLE:
                privacyValue = PrivacyValue.DISABLE;
                break;
        }
        return privacyValue;
    }
}

@@ -774,26 +774,42 @@
       NOBODY
+(PRIVACY_NOBODY)
 ,%0A
-
         @Ser
@@ -848,16 +848,31 @@
    USERS
+(PRIVACY_USERS)
 ,%0A      
@@ -921,16 +921,33 @@
  ANYBODY
+(PRIVACY_ANYBODY)
 ,%0A      
@@ -988,16 +988,29 @@
      VOD
+(PRIVACY_VOD)
 , // %22pt
@@ -1070,16 +1070,34 @@
 CONTACTS
+(PRIVACY_CONTACTS)
 ,%0A      
@@ -1148,16 +1148,34 @@
 PASSWORD
+(PRIVACY_PASSWORD)
 ,%0A      
@@ -1224,16 +1224,598 @@
  DISABLE
+(PRIVACY_DISABLE);%0A%0A        private String text;%0A%0A        PrivacyValue(String text) %7B%0A            this.text = text;%0A        %7D%0A%0A        public String getText() %7B%0A            return this.text;%0A        %7D%0A%0A        public static PrivacyValue privacyValueFromString(String text) %7B%0A            if (text != null) %7B%0A                for (PrivacyValue privacyValue : PrivacyValue.values()) %7B%0A                    if (text.equalsIgnoreCase(privacyValue.text)) %7B%0A                        return privacyValue;%0A                    %7D%0A                %7D%0A            %7D%0A            return null;%0A        %7D
 %0A    %7D%0A%0A
@@ -2790,32 +2790,32 @@
 eak;%0A        %7D%0A%0A
+
         return p
@@ -2837,974 +2837,7 @@
    %7D
-%0A%0A    static public PrivacyValue privacyValueFromString(final String string) %7B%0A        PrivacyValue privacyValue = PrivacyValue.ANYBODY;%0A        switch (string) %7B%0A            case PRIVACY_NOBODY:%0A                privacyValue = PrivacyValue.NOBODY;%0A                break;%0A            case PRIVACY_USERS:%0A                privacyValue = PrivacyValue.USERS;%0A                break;%0A            case PRIVACY_ANYBODY:%0A                privacyValue = PrivacyValue.ANYBODY;%0A                break;%0A            case PRIVACY_VOD:%0A                privacyValue = PrivacyValue.VOD;%0A                break;%0A            case PRIVACY_CONTACTS:%0A                privacyValue = PrivacyValue.CONTACTS;%0A                break;%0A            case PRIVACY_PASSWORD:%0A                privacyValue = PrivacyValue.PASSWORD;%0A                break;%0A            case PRIVACY_DISABLE:%0A                privacyValue = PrivacyValue.DISABLE;%0A                break;%0A        %7D%0A        return privacyValue;%0A    %7D
 %0A%7D%0A

change to privacy model