package com.atlassian.jira.plugins.dvcs.model;

import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

@XmlRootElement
public class Organization
{
    private int id;
    private String hostUrl;
    private String name;
    private String dvcsType;
    private boolean autolinkNewRepos;
    private Credential credential;

    public Organization()
	{
    	super();
	}
    
    public Organization(int id, String hostUrl, String name, String dvcsType, boolean autolinkNewRepos, Credential credential)
    {
        this.id = id;
        this.hostUrl = hostUrl;
        this.name = name;
        this.dvcsType = dvcsType;
        this.autolinkNewRepos = autolinkNewRepos;
        this.credential = credential;
    }

    public int getId()
    {
        return id;
    }

    public String getHostUrl()
    {
        return hostUrl;
    }

    public String getName()
    {
        return name;
    }

    public String getDvcsType()
    {
        return dvcsType;
    }

    public boolean isAutolinkNewRepos()
    {
        return autolinkNewRepos;
    }

    public Credential getCredential()
    {
        return credential;
    }

    public void setId(int id)
	{
		this.id = id;
	}

	public void setHostUrl(String hostUrl)
	{
		this.hostUrl = hostUrl;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public void setDvcsType(String dvcsType)
	{
		this.dvcsType = dvcsType;
	}

	public void setAutolinkNewRepos(boolean autolinkNewRepos)
	{
		this.autolinkNewRepos = autolinkNewRepos;
	}

	public void setCredential(Credential credential)
	{
		this.credential = credential;
	}

    @Override
    public boolean equals(Object o)
    {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Organization that = (Organization) o;

        return new EqualsBuilder()
                .append(id, that.id)
                .append(hostUrl, that.hostUrl)
                .append(name, that.name)
                .append(dvcsType, that.dvcsType)
                .append(credential, that.credential)
                .isEquals();
    }

    @Override
    public int hashCode()
    {
        return new HashCodeBuilder()
                .append(id)
                .append(hostUrl)
                .append(name)
                .append(dvcsType)
                .append(credential)
                .hashCode();
    }

}

@@ -435,24 +435,68 @@
 dential;%0D%0A%0D%0A
+    private Repository %5B%5D repositories;%0D%0A %0D%0A
     public O
@@ -2647,11 +2647,189 @@
    %7D%0D%0A%0D%0A
+%09public Repository%5B%5D getRepositories()%0D%0A%09%7B%0D%0A%09%09return repositories;%0D%0A%09%7D%0D%0A%0D%0A%09public void setRepositories(Repository%5B%5D repositories)%0D%0A%09%7B%0D%0A%09%09this.repositories = repositories;%0D%0A%09%7D%0D%0A%0D%0A
 %7D%0D%0A

Extend transfer model for organization.