package siprp.database.cayenne.objects;

import java.util.HashMap;

import siprp.database.cayenne.objects.auto._Trabalhadores;

public class Trabalhadores extends _Trabalhadores
{
	private static final long serialVersionUID = 1L;

	private String getCapitalizedName()
	{
		String result = "";
		String[] names = getNomePlain().split( " " );
		if( names != null && names.length > 0 )
		{
			for( String name : names )
			{
				if( name != null && name.length() > 0 )
				{
					result += ("" + name.charAt( 0 )).toUpperCase();
					if( name.length() > 1 )
					{
						result += name.substring( 1 );
					}
					result += " ";
				}
			}
		}
		return result.trim();
	}

	public String getDataNascimentoString()
	{
		return getDataNascimento() == null ? "" : sdf.format( getDataNascimento() );
	}

	public String getNomePlainCapital()
	{
		return getNomePlain() == null ? "" : getCapitalizedName();
	}

	public HashMap<String, String> getSexos()
	{
		HashMap<String, String> result = new HashMap<String, String>();
		result.put("f", "Feminino");
		result.put( "m", "Masculino" );
		return result;
	}

	@Override
	public String toString()
	{
		return getNomePlain();
	}

}
