/*
 * Copyright 2013 OrgSync
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/
package com.orgsync.api.model.accounts;

import java.lang.reflect.Type;
import java.util.List;

import com.google.gson.reflect.TypeToken;

/**
 * Detailed view of an account.
 * 
 * @author steffyj
 * 
 */
public class AccountDetail extends Account {

    public static final Type TYPE = new TypeToken<AccountDetail>() {
    }.getType();

    private String picUrl;
    private List<Integer> orgIds;

    public final String getPicUrl() {
        return picUrl;
    }

    public final List<Integer> getOrgIds() {
        return orgIds;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((orgIds == null) ? 0 : orgIds.hashCode());
        result = prime * result + ((picUrl == null) ? 0 : picUrl.hashCode());
        return result;
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        AccountDetail other = (AccountDetail) obj;
        if (orgIds == null) {
            if (other.orgIds != null)
                return false;
        } else if (!orgIds.equals(other.orgIds))
            return false;
        if (picUrl == null) {
            if (other.picUrl != null)
                return false;
        } else if (!picUrl.equals(other.picUrl))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "AccountDetail [picUrl=" + picUrl + ", orgIds=" + orgIds + "]";
    }

}

@@ -2142,84 +2142,290 @@
     
-return %22AccountDetail %5BpicUrl=%22 + picUrl + %22, orgIds=%22 + orgIds + %22%5D%22;%0A    %7D%0A
+final StringBuilder sb = new StringBuilder(%22AccountDetail%7B%22);%0A        sb.append(%22picUrl='%22).append(picUrl).append('%5C'');%0A        sb.append(%22, orgIds=%22).append(orgIds);%0A        sb.append(%22, super=%22).append(super.toString());%0A        sb.append('%7D');%0A        return sb.toString();%0A    %7D
 %0A%7D%0A

fix toString for AccountDetail to call super