package com.ejie.ad74a.model;

import com.ejie.ad74a.constantes.Constantes;
import com.ejie.x38.serialization.JsonDateDeserializer;
import com.ejie.x38.serialization.JsonDateSerializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import org.springframework.context.i18n.LocaleContextHolder;

/**
 * MaestroTiposAviso generated by UDA, 12-may-2023 11:16:38.
 * 
 * @author UDA
 */

public class MaestroTiposAviso implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Long idTipoAviso40;
	private String descEs40;
	private String descEu40;
	private Date fBaja40;
	private List<Avisos> avisoses = new ArrayList<Avisos>();

	/**
	 * Method 'MaestroTiposAviso'.
	 */
	public MaestroTiposAviso() {
	}

	/**
	 * Method 'MaestroTiposAviso'.
	 * 
	 * @param idTipoAviso40 Long
	 */
	public MaestroTiposAviso(Long idTipoAviso40) {
		this.idTipoAviso40 = idTipoAviso40;
	}

	/**
	 * Method 'MaestroTiposAviso'.
	 * 
	 * @param idTipoAviso40 Long
	 * @param descEs40      String
	 * @param descEu40      String
	 * @param fBaja40       Date
	 */
	public MaestroTiposAviso(Long idTipoAviso40, String descEs40, String descEu40, Date fBaja40) {
		this.idTipoAviso40 = idTipoAviso40;
		this.descEs40 = descEs40;
		this.descEu40 = descEu40;
		this.fBaja40 = fBaja40;
	}

	/**
	 * Method 'MaestroTiposAviso'.
	 * 
	 * @param idTipoAviso40 Long
	 * @param descEs40      String
	 * @param descEu40      String
	 * @param fBaja40       Date
	 * @param avisoses      List<Avisos>
	 */
	public MaestroTiposAviso(Long idTipoAviso40, String descEs40, String descEu40, Date fBaja40,
			List<Avisos> avisoses) {

		this.idTipoAviso40 = idTipoAviso40;
		this.descEs40 = descEs40;
		this.descEu40 = descEu40;
		this.fBaja40 = fBaja40;
		this.avisoses = avisoses;
	}

	/**
	 * Method 'getIdTipoAviso40'.
	 *
	 * @return Long
	 */

	public Long getIdTipoAviso40() {
		return this.idTipoAviso40;
	}

	/**
	 * Method 'setIdTipoAviso40'.
	 *
	 * @param idTipoAviso40 Long
	 * @return
	 */

	public void setIdTipoAviso40(Long idTipoAviso40) {
		this.idTipoAviso40 = idTipoAviso40;
	}

	/**
	 * Method 'getDescEs40'.
	 *
	 * @return String
	 */

	public String getDescEs40() {
		return this.descEs40;
	}

	/**
	 * Method 'setDescEs40'.
	 *
	 * @param descEs40 String
	 * @return
	 */

	public void setDescEs40(String descEs40) {
		this.descEs40 = descEs40;
	}

	/**
	 * Method 'getDescEu40'.
	 *
	 * @return String
	 */

	public String getDescEu40() {
		return this.descEu40;
	}

	/**
	 * Method 'setDescEu40'.
	 *
	 * @param descEu40 String
	 * @return
	 */

	public void setDescEu40(String descEu40) {
		this.descEu40 = descEu40;
	}

	/**
	 * Method 'getfBaja40'.
	 *
	 * @return java.util.Date
	 */

	@JsonSerialize(using = JsonDateSerializer.class)
	public Date getfBaja40() {
		return this.fBaja40;
	}

	/**
	 * Method 'setfBaja40'.
	 *
	 * @param fBaja40 java.util.Date
	 * @return
	 */
	@JsonDeserialize(using = JsonDateDeserializer.class)
	public void setfBaja40(Date fBaja40) {
		this.fBaja40 = fBaja40;
	}

	/**
	 * Method 'getAvisoses'.
	 *
	 * @return List
	 */
	@JsonIgnore
	public List<Avisos> getAvisoses() {
		return this.avisoses;
	}

	/**
	 * Method 'setAvisoses'.
	 *
	 * @param avisoses List
	 * @return
	 */
	public void setAvisoses(List<Avisos> avisoses) {
		this.avisoses = avisoses;
	}

	/**
	 * Intended only for logging and debugging.
	 * 
	 * Here, the contents of every main field are placed into the result.
	 * 
	 * @return String
	 */
	@Override
	public String toString() {
		StringBuilder result = new StringBuilder();
		result.append(this.getClass().getName()).append(" Object { ");
		result.append(" [ idTipoAviso40: ").append(this.idTipoAviso40).append(" ]");
		result.append(", [ descEs40: ").append(this.descEs40).append(" ]");
		result.append(", [ descEu40: ").append(this.descEu40).append(" ]");
		result.append(", [ fBaja40: ").append(this.fBaja40).append(" ]");
		result.append("}");
		return result.toString();
	}

	/**
	 * Method 'getDesc'.
	 *
	 * @return String
	 */
	public String getDesc() {
		Locale locale = LocaleContextHolder.getLocale();

		if (locale.equals(Constantes.LOCALE_ES)) {
			return this.descEs40;
		} else {
			return this.descEu40;
		}
	}

}
