/***
 * Excerpted from "Domain-Driven Design Using Naked Objects",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material, 
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose. 
 * Visit http://www.pragmaticprogrammer.com/titles/dhnako for more book information.
***/
package com.pragprog.dhnako.carserv.dom.customer;

import java.util.Arrays;
import java.util.List;

import org.nakedobjects.applib.AbstractDomainObject;
import org.nakedobjects.applib.annotation.MaxLength;
import org.nakedobjects.applib.annotation.MemberOrder;
import org.nakedobjects.applib.annotation.MultiLine;
import org.nakedobjects.applib.annotation.Optional;
import org.nakedobjects.applib.util.TitleBuffer;

public class Customer extends AbstractDomainObject {

	// {{ Identification
	public String title() {
		final TitleBuffer buf = new TitleBuffer();
	    if (getTitle() != null) {
	        buf.append(getTitle());
	    }
		buf.append(getFirstName()).append(getLastName());
		return buf.toString();
	}
	// }}

	
	// {{ Title
	private String title;

	@MemberOrder(sequence = "1.1")
	public String getTitle() {
		return title;
	}

	public void setTitle(final String title) {
		this.title = title;
	}

	public List<String> choicesTitle() {
		return Arrays.asList("Mr", "Mrs", "Ms", "Miss");
	}
	// }}



	// {{ FirstName
	private String firstName;

	@MaxLength(30)
	@MemberOrder(sequence = "1.3")
	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(final String firstName) {
		this.firstName = firstName;
	}
	// }}

	// {{ LastName
	private String lastName;

	@MaxLength(30)
	@MemberOrder(sequence = "1.2")
	public String getLastName() {
		return lastName;
	}

	public void setLastName(final String lastName) {
		this.lastName = lastName;
	}
	// }}

	// {{ Notes
	private String notes;

    @MultiLine(numberOfLines = 10, preventWrapping = false)
    @Optional
    @MaxLength(255)
	@MemberOrder(sequence = "1.3")
	public String getNotes() {
		return notes;
	}

	public void setNotes(final String notes) {
		this.notes = notes;
	}
	// }}



}
