package nc.noumea.mairie.pdc.entity;

/*
 * #%L
 * Logiciel de Gestion des Permis de Construire de la Ville de Nouméa
 * %%
 * Copyright (C) 2013 - 2016 Mairie de Nouméa, Nouvelle-Calédonie
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-3.0.html>.
 * #L%
 */

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Version;

import nc.noumea.mairie.pdc.core.entity.AbstractEntity;

/**
 * Cection cadastrale, modélisée par un couple (code, libellé) (ex : code="03", libellé="BAIE DES CITRONS")
 * 
 * @author AgileSoft.NC
 */
@Entity
public class SectionCadastrale extends AbstractEntity {
	private static final long	serialVersionUID	= 1L;

	@Version
	private Integer				version;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "s_section_cadastrale")
	@SequenceGenerator(name = "s_section_cadastrale", sequenceName = "s_section_cadastrale", allocationSize = 1)
	Long						id;

	@Override
	public Long getId() {
		return id;
	}

	@Override
	public Integer getVersion() {
		return this.version;
	}

	@Column(length = 40)
	String	libelle;

	@Column(length = 10)
	String	code;

	/**
	 * @return le libellé de la section, ex : "VALLEE DES COLONS"
	 */
	public String getLibelle() {
		return libelle;
	}

	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}

	/**
	 * @return le code (standardisé) de la section, ex : "12" pour Vallée des colons
	 */
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Override
	public String getLibelleCourt() {
		return this.libelle;
	}
}
