package com.ejie.m62fb.dao;

import com.ejie.m62fb.dao.SQLGenericas;
import com.ejie.m62fb.utils.constants.BDConstantes;

public class PersonaDaoSql {

	/**
	 * StringBuilder initilization value
	 */
	public static final int STRING_BUILDER_INIT = 4096;
	public static final String SEQUENCE_NAME = "";
	// TODO Poner el sinonimo en M62FB

	public static final String TABLA = BDConstantes.PERSONA;

	public static final String PK = "ID_PERSONA";

	public static final String SQL_EXISTE_NIF = "SELECT ID_PERSONA FROM " + TABLA + " WHERE NIF_TITULAR = ? AND NUM_CORREL_NIF = 0";
	

	public static final String SQL_SELECT = "SELECT NIF_TITULAR,NUM_CORREL_NIF,COD_TIPO_CLAVE," +
	"ITIPIDEN,NOM_APELLIDO_1,NOM_APELLIDO_2,NOM_NOMBRE,FEC_NACIMIENTO,IND_SEXO,ISEXO," +
	"IND_ESTADO_CIVIL,IESTCIVI,CPAIS,DPAIS,CTERRITO,COD_PROVINCIA,DTERRITO,CMUNICIP," +
	"COD_MUNICIPIO,DMUNICIP,DDIRECCI,EMAIL,NTELEFNO,NUM_TLFNO_2,COD_CALLE,COD_PORTAL," +
	"DEC_SIT_VIV,DEC_MANO,COD_POSTAL,NUM_COD_POSTAL,COD_APLICACION,ID_PERSONA,DES_CALLE,COD_NACIONALIDAD"
	+ SQLGenericas.getSqlCamposDireccion(null)
	+ SQLGenericas.getSqlCamposAbstractClass(null);
	public static final String SQL_SELECT_SVDI = "SELECT COD_EST_RES,DES_EST_RES,NOM_TITULAR, APE1_TITULAR,APE2_TITULAR" +
			", SEXO_TITULAR, FEC_NAC_TITULAR,DATOS_VIA_DIR, LOCALIDAD_DIR, PROVINCIA_DIR," +
			"FEC_CAD_CERTIF, NAC_TITULAR FROM T19G0S20 WHERE ID_T19G0T00 = ?";
	public static final String SQL_INSERT_SVDI = "INSERT INTO T19G0S00 (COD_SIT_PET,COD_PROCESO,TEX_PARAMETROS,COD_USU_PET,COD_USU_ULT_MODIF)" +
			" VALUES ('P','ws.integracion.interop.svdi',?,?,?)";

	public static final String SQL_SELECT_COUNT = "SELECT COUNT(1)";

	public static final String SQL_FROM = " FROM " + TABLA;

	public static final String SQL_WHERE_ALL = " WHERE 1=1 ";

	public static final String SQL_WHERE_ID = SQL_WHERE_ALL + " AND "
			+ PK +" = ?";

	public static final String SQL_WHERE_FOR_UPDATE = SQL_WHERE_ID
			+ " AND FEH_ULT_MODIF = ?";

	public static final String SQL_FIND_FOR_UPDATE = SQL_SELECT + SQL_FROM
			+ SQL_WHERE_FOR_UPDATE;

	public static final String SQL_FIND = SQL_SELECT + SQL_FROM + SQL_WHERE_ID;

	public static final String SQL_FIND_ALL = SQL_SELECT + SQL_FROM;

	public static final String SQL_FIND_ALL_COUNT = SQL_SELECT_COUNT + SQL_FROM;

}