---
# System prepended metadata

title: Casavo Title Builder Kata

---

# Casavo Title Builder Kata

The target of the exercise is to develop a title builder for Casavo.

The title builder should create the title to publish on the listing platform starting from:

- the property characteristics (address, number of rooms, ecc ..)
- the visiting language (it, en, es, pt)

Every country has a different way to express the type of the apartment and label the number of rooms, see Test Cases below.


---

### Test Cases

From an property with this specs:

    "multi rooms apartment with number title"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :apartment,
    living_rooms: 3,
    bedrooms: 2,
    bathrooms: 1,
    rooms: 2 + 3,
    commercial_area: 55,
    show_street_number: true

we expect following titles:

     %{language: :it, text: "Plurilocale di 55m² in Via del Test 33"},
     %{language: :en, text: "Two-bedroom Apartment of 55m² in Via del Test 33"},
     %{language: :es, text: "Vivienda 55m² – 2 habitaciones en Via del Test 33"},
     %{language: :pt, text: "Apartamento T2 de 55m² em Via del Test 33"}
---
From an property with this specs:

    "multi rooms apartment without number title"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :apartment,
    living_rooms: 3,
    bedrooms: 2,
    bathrooms: 1,
    rooms: 2 + 3,
    commercial_area: 55,
    show_street_number: false

we expect following titles:

    %{language: :it, text: "Plurilocale di 55m² in Via del Test"},
    %{language: :en, text: "Two-bedroom Apartment of 55m² in Via del Test"},
    %{language: :es, text: "Vivienda 55m² – 2 habitaciones en Via del Test"},
    %{language: :pt, text: "Apartamento T2 de 55m² em Via del Test"}
---
From an property with this specs:

    "one room apartment without bedrooms"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :apartment,
    living_rooms: 0,
    bedrooms: 0,
    bathrooms: 1,
    rooms: 1,
    commercial_area: 35,
    show_street_number: false

we expect following titles:

    %{language: :it, text: "Monolocale di 35m² in Via del Test"},
    %{language: :en, text: "Studio of 35m² in Via del Test"},
    %{language: :es, text: "Estudio 35m² en Via del Test"},
    %{language: :pt, text: "Apartamento T0 de 35m² em Via del Test"}
---
From an property with this specs:
  
    "two rooms apartment"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :apartment,
    living_rooms: 1,
    bedrooms: 1,
    bathrooms: 1,
    rooms: 1 + 1,
    commercial_area: 45,
    show_street_number: false

we expect following titles:

	%{language: :it, text: "Bilocale di 45m² in Via del Test"},
	%{language: :en, text: "One-bedroom Apartment of 45m² in Via del Test"},
	%{language: :es, text: "Vivienda 45m² – 1 habitaciones en Via del Test"},
	%{language: :pt, text: "Apartamento T1 de 45m² em Via del Test"}
---
From an property with this specs:
  
    "three rooms apartment"
	address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
	residential_type: :apartment,
	living_rooms: 1,
	bedrooms: 2,
	bathrooms: 1,
	rooms: 1 + 2,
	commercial_area: 65,
	show_street_number: true

we expect following titles:

	%{language: :it, text: "Trilocale di 65m² in Via del Test 33"},
	%{language: :en, text: "Two-bedroom Apartment of 65m² in Via del Test 33"},
	%{language: :es, text: "Vivienda 65m² – 2 habitaciones en Via del Test 33"},
	%{language: :pt, text: "Apartamento T2 de 65m² em Via del Test 33"}
---
From an property with this specs:

    "four rooms apartment"
	address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
	residential_type: :apartment,
	living_rooms: 2,
	bedrooms: 2,
	bathrooms: 1,
	rooms: 2 + 2,
	commercial_area: 85,
	show_street_number: false

we expect following titles:

	%{language: :it, text: "Quadrilocale di 85m² in Via del Test"},
	%{language: :en, text: "Two-bedroom Apartment of 85m² in Via del Test"},
	%{language: :es, text: "Vivienda 85m² – 2 habitaciones en Via del Test"},
	%{language: :pt, text: "Apartamento T2 de 85m² em Via del Test"}

---
From an property with this specs:

    "attic"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :attic,
    living_rooms: 2,
    bedrooms: 2,
    bathrooms: 1,
    rooms: 2 + 2,
    commercial_area: 105,
    show_street_number: true

we expect following titles:

	%{language: :it, text: "Attico di 105m² in Via del Test 33"},
	%{language: :en, text: "Attic of 105m² in Via del Test 33"},
	%{language: :es, text: "Vivienda 105m² – 2 habitaciones en Via del Test 33"},
	%{language: :pt, text: "Sótão de 105m² em Via del Test 33"}

---
From an property with this specs:

    "mansard"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :mansard,
    living_rooms: 1,
    bedrooms: 1,
    bathrooms: 1,
    rooms: 1 + 1,
    commercial_area: 75,
    show_street_number: false

we expect following titles:
	
    %{language: :it, text: "Mansarda di 75m² in Via del Test"},
	%{language: :en, text: "Mansard of 75m² in Via del Test"},
	%{language: :es, text: "Vivienda 75m² – 1 habitaciones en Via del Test"},
	%{language: :pt, text: "Mansarda de 75m² em Via del Test"}

---
From an property with this specs:

	"loft"
	address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
	residential_type: :loft,
	living_rooms: 2,
	bedrooms: 2,
	bathrooms: 1,
	rooms: 2 + 2,
	commercial_area: 105,
	show_street_number: true

we expect following titles:

	%{language: :it, text: "Loft di 105m² in Via del Test 33"},
	%{language: :en, text: "Two-bedroom Loft of 105m² in Via del Test 33"},
	%{language: :es, text: "Vivienda 105m² – 2 habitaciones en Via del Test 33"},
	%{language: :pt, text: "Loft de 105m² em Via del Test 33"}

---
From an property with this specs:

	"house"
	address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
	residential_type: :house,
	living_rooms: 2,
	bedrooms: 2,
	bathrooms: 1,
	rooms: 2 + 2,
	commercial_area: 105,
	show_street_number: true

we expect following titles:

    %{language: :it, text: "Casa indipendente di 105m² in Via del Test 33"},
    %{language: :en, text: "Two-bedroom House of 105m² in Via del Test 33"},
    %{language: :es, text: "Vivienda 105m² – 2 habitaciones en Via del Test 33"},
    %{language: :pt, text: "Casa independente de 105m² em Via del Test 33"}

---
From an property with this specs:

	"townhouse"
	address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
	residential_type: :townhouse,
	living_rooms: 3,
	bedrooms: 3,
	bathrooms: 2,
	rooms: 3 + 3,
	commercial_area: 155,
	show_street_number: true

we expect following titles:

	%{language: :it, text: "Villetta a schiera di 155m² in Via del Test 33"},
	%{language: :en, text: "Three-bedroom Townhouse of 155m² in Via del Test 33"},
	%{language: :es, text: "Vivienda 155m² – 3 habitaciones en Via del Test 33"},
	%{language: :pt, text: "Casa geminada de 155m² em Via del Test 33"}

---
From an property with this specs:

    "villa"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :villa,
    living_rooms: 3,
    bedrooms: 5,
    bathrooms: 3,
    rooms: 3 + 5,
    commercial_area: 205,
    show_street_number: false

we expect following titles:

	%{language: :it, text: "Villa di 205m² in Via del Test"},
	%{language: :en, text: "Multi-bedroom Villa of 205m² in Via del Test"},
	%{language: :es, text: "Vivienda 205m² – 5 habitaciones en Via del Test"},
	%{language: :pt, text: "Moradia de 205m² em Via del Test"}

---
From an property with this specs:

    "duplex"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :duplex,
    living_rooms: 3,
    bedrooms: 5,
    bathrooms: 3,
    rooms: 3 + 5,
    commercial_area: 205,
    show_street_number: false

we expect following titles:

	%{language: :it, text: "Duplex di 205m² in Via del Test"},
	%{language: :en, text: "Multi-bedroom Duplex of 205m² in Via del Test"},
	%{language: :es, text: "Vivienda 205m² – 5 habitaciones en Via del Test"},
	%{language: :pt, text: "Duplex de 205m² em Via del Test"}

---
From an property with this specs:

    "studio"
    address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
    residential_type: :studio,
    living_rooms: 3,
    bedrooms: 5,
    bathrooms: 3,
    rooms: 3 + 5,
    commercial_area: 205,
    show_street_number: false

we expect following titles:

	%{language: :it, text: "Studio di 205m² in Via del Test"},
	%{language: :en, text: "Multi-bedroom Studio of 205m² in Via del Test"},
	%{language: :es, text: "Vivienda 205m² – 5 habitaciones en Via del Test"},
	%{language: :pt, text: "Studio de 205m² em Via del Test"}

---
From an property with this specs:

	"cottage"
	address: %{street: "Via del Test", street_number: "33", zip_code: "any"},
	residential_type: :cottage,
	living_rooms: 3,
	bedrooms: 5,
	bathrooms: 3,
	rooms: 3 + 5,
	commercial_area: 205,
	show_street_number: false

we expect following titles:

	%{language: :it, text: "Cottage di 205m² in Via del Test"},
	%{language: :en, text: "Multi-bedroom Cottage of 205m² in Via del Test"},
	%{language: :es, text: "Vivienda 205m² – 5 habitaciones en Via del Test"},
	%{language: :pt, text: "Cottage de 205m² em Via del Test"}
    
---
From an property with this specs:

    "upper case street formatting"
    address: %{street: "VIA DEL TEST", street_number: "33", zip_code: "any"},
    residential_type: :villa,
    living_rooms: 2,
    bedrooms: 2,
    bathrooms: 2,
    rooms: 2 + 2,
    commercial_area: 105,
    show_street_number: false

we expect following titles:
    
    %{language: :it, text: "Villa di 105m² in Via Del Test"},
    %{language: :en, text: "Two-bedroom Villa of 105m² in Via Del Test"},
    %{language: :es, text: "Vivienda 105m² – 2 habitaciones en Via Del Test"},
    %{language: :pt, text: "Moradia de 105m² em Via Del Test"}

---
From an property with this specs:

    "lower case street formatting"
    address: %{street: "via del test", street_number: "33", zip_code: "any"},
    residential_type: :apartment,
    living_rooms: 2,
    bedrooms: 1,
    bathrooms: 1,
    rooms: 2 + 1,
    commercial_area: 90,
    show_street_number: true

we expect following titles:

    %{language: :it, text: "Trilocale di 90m² in Via Del Test 33"},
    %{language: :en, text: "One-bedroom Apartment of 90m² in Via Del Test 33"},
    %{language: :es, text: "Vivienda 90m² – 1 habitaciones en Via Del Test 33"},
    %{language: :pt, text: "Apartamento T1 de 90m² em Via Del Test 33"}
