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;

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

public class MaestroSubtiposAviso implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Long idSubTipoAviso41;
	private MaestroTiposAviso maestroTiposAviso;
	private String descEs41;
	private String descEu41;
	private Date fBaja41;
	private String mensajeEs41;
	private String mensajeEu41;
	private List<MaestroSubtiposAvisoActor> maestroSubtiposAvisoActors = new ArrayList<MaestroSubtiposAvisoActor>();
	private List<Avisos> avisoses = new ArrayList<Avisos>();

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

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

	/**
	 * Method 'MaestroSubtiposAviso'.
	 * 
	 * @param idSubTipoAviso41  Long
	 * @param maestroTiposAviso MaestroTiposAviso
	 * @param descEs41          String
	 * @param descEu41          String
	 * @param fBaja41           Date
	 */
	public MaestroSubtiposAviso(Long idSubTipoAviso41, MaestroTiposAviso maestroTiposAviso, String descEs41,
			String descEu41, Date fBaja41, String mensajeEs41, String mensajeEu41) {
		this.idSubTipoAviso41 = idSubTipoAviso41;
		this.maestroTiposAviso = maestroTiposAviso;
		this.descEs41 = descEs41;
		this.descEu41 = descEu41;
		this.fBaja41 = fBaja41;
		this.mensajeEs41 = mensajeEs41;
		this.mensajeEu41 = mensajeEu41;
	}

	/**
	 * Method 'MaestroSubtiposAviso'.
	 * 
	 * @param idSubTipoAviso41           Long
	 * @param maestroTiposAviso          MaestroTiposAviso
	 * @param descEs41                   String
	 * @param descEu41                   String
	 * @param fBaja41                    Date
	 * @param maestroSubtiposAvisoActors List<MaestroSubtiposAvisoActor>
	 * @param avisoses                   List<Avisos>
	 */
	public MaestroSubtiposAviso(Long idSubTipoAviso41, MaestroTiposAviso maestroTiposAviso, String descEs41,
			String descEu41, Date fBaja41, List<MaestroSubtiposAvisoActor> maestroSubtiposAvisoActors,
			List<Avisos> avisoses) {

		this.idSubTipoAviso41 = idSubTipoAviso41;
		this.maestroTiposAviso = maestroTiposAviso;
		this.descEs41 = descEs41;
		this.descEu41 = descEu41;
		this.fBaja41 = fBaja41;
		this.maestroSubtiposAvisoActors = maestroSubtiposAvisoActors;
		this.avisoses = avisoses;
	}

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

	public Long getIdSubTipoAviso41() {
		return this.idSubTipoAviso41;
	}

	/**
	 * Method 'setIdSubTipoAviso41'.
	 *
	 * @param idSubTipoAviso41 Long
	 * @return
	 */

	public void setIdSubTipoAviso41(Long idSubTipoAviso41) {
		this.idSubTipoAviso41 = idSubTipoAviso41;
	}

	/**
	 * Method 'getMaestroTiposAviso'.
	 *
	 * @return MaestroTiposAviso
	 */

	public MaestroTiposAviso getMaestroTiposAviso() {
		return this.maestroTiposAviso;
	}

	/**
	 * Method 'setMaestroTiposAviso'.
	 *
	 * @param maestroTiposAviso MaestroTiposAviso
	 * @return
	 */

	public void setMaestroTiposAviso(MaestroTiposAviso maestroTiposAviso) {
		this.maestroTiposAviso = maestroTiposAviso;
	}

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

	public String getDescEs41() {
		return this.descEs41;
	}

	/**
	 * Method 'setDescEs41'.
	 *
	 * @param descEs41 String
	 * @return
	 */

	public void setDescEs41(String descEs41) {
		this.descEs41 = descEs41;
	}

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

	public String getDescEu41() {
		return this.descEu41;
	}

	/**
	 * Method 'setDescEu41'.
	 *
	 * @param descEu41 String
	 * @return
	 */

	public void setDescEu41(String descEu41) {
		this.descEu41 = descEu41;
	}

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

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

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

	/**
	 * Method 'getMaestroSubtiposAvisoActors'.
	 *
	 * @return List
	 */
	@JsonIgnore
	public List<MaestroSubtiposAvisoActor> getMaestroSubtiposAvisoActors() {
		return this.maestroSubtiposAvisoActors;
	}

	/**
	 * Method 'setMaestroSubtiposAvisoActors'.
	 *
	 * @param maestroSubtiposAvisoActors List
	 * @return
	 */
	public void setMaestroSubtiposAvisoActors(List<MaestroSubtiposAvisoActor> maestroSubtiposAvisoActors) {
		this.maestroSubtiposAvisoActors = maestroSubtiposAvisoActors;
	}

	/**
	 * 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(" [ idSubTipoAviso41: ").append(this.idSubTipoAviso41).append(" ]");
		result.append(", [ maestroTiposAviso: ").append(this.maestroTiposAviso).append(" ]");
		result.append(", [ descEs41: ").append(this.descEs41).append(" ]");
		result.append(", [ descEu41: ").append(this.descEu41).append(" ]");
		result.append(", [ fBaja41: ").append(this.fBaja41).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.descEs41;
		} else {
			return this.descEu41;
		}
	}

	public String getMensajeEs41() {
		return mensajeEs41;
	}

	public void setMensajeEs41(String mensajeEs41) {
		this.mensajeEs41 = mensajeEs41;
	}

	public String getMensajeEu41() {
		return mensajeEu41;
	}

	public void setMensajeEu41(String mensajeEu41) {
		this.mensajeEu41 = mensajeEu41;
	}

	public String getMensaje() {
		if (LocaleContextHolder.getLocale().getLanguage().equalsIgnoreCase(Constantes.LOCALE_ES.getLanguage())) {
			return this.getMensajeEs41();
		} else if (LocaleContextHolder.getLocale().getLanguage().equalsIgnoreCase(Constantes.LOCALE_EU.getLanguage())) {
			return this.getMensajeEu41();
		}
		return "";
	}

}
