<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rentbits.com/collector" xmlns="http://rentbits.com/collector" elementFormDefault="qualified">
  <xsd:annotation>
    <xsd:documentation xml:lang="en">
     Rental data collector schema.
     Copyright 2007 RentBits.com. All rights reserved.
     $Revision: 1.7 $
    </xsd:documentation>
  </xsd:annotation>

  <xsd:element name="ads" type="adListType"/>

  <xsd:complexType name="adListType">
    <xsd:sequence>
      <xsd:element name="cv" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- Collector version = 1.2 -->
      <xsd:element name="siteUrl" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/><!-- site's URL -->
      <xsd:element name="method" type="xsd:string" minOccurs="1" maxOccurs="1"/><!-- Overlay or Incremental -->
      <xsd:element name="ad" type="adType" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
  
  <xsd:complexType name="adType">
    <xsd:sequence>
      <xsd:element name="market" type="marketType" nillable="false"/>
      <xsd:element name="action" type="actionType" nillable="true"/>
      <!-- NOTE: either fAddress or address element is required -->
      <xsd:element name="fAddress" type="xsd:string"/> <!-- full comma delimited address; i.e. 11 Main Street, #A, Denver, Colorado, 80110, US -->
      <xsd:element name="address" type="addressType"/>
      <xsd:element name="commName" type="xsd:string" nillable="true"/> <!-- Required for market=A - apartment community name -->
      <xsd:element name="floorPlan" type="xsd:string" nillable="true"/> <!-- Required for market=A - floor plan name -->
      <xsd:element name="latitude" type="xsd:decimal" nillable="true"/>
      <xsd:element name="longitude" type="xsd:decimal" nillable="true"/>
      <xsd:element name="url" type="xsd:anyURI" nillable="false"/> <!-- full ad's url -->
      <xsd:element name="type" type="propType" nillable="false"/>
      <xsd:element name="headline" type="xsd:string" nillable="false"/>
      <xsd:element name="description" type="xsd:string" nillable="false"/> <!-- CDATA if needs to store HTML -->

      <!-- NOTE: if no values are provide for elements below please do include them as empty one -->
      <xsd:element name="beds" type="xsd:string"/> <!-- 0,1,2,3,4,etc. -->
      <xsd:element name="baths" type="xsd:string"/> <!-- 0,1,1.5,2,2.5,3,etc. -->
      <xsd:element name="price" type="xsd:string"/>
      <xsd:element name="priceMax" type="xsd:string"/>
      <xsd:element name="priceCurr" type="xsd:string"/> <!-- Empty assumes USD -->
      <xsd:element name="lease" type="xsd:string"/> <!-- if many - comma delimited lease terms accepted -->
      <xsd:element name="deposit" type="xsd:string"/>
      <xsd:element name="area" type="xsd:string"/> <!-- living area size in sq feet or meters -->
      <xsd:element name="areaMax" type="xsd:string"/>
      <xsd:element name="sqt" type="sqAreaType"/> <!-- living area square type -->
      <xsd:element name="floor" type="xsd:string"/> <!-- comma delimited flooring: i.e. hard wood, carpet -->
      <xsd:element name="img1" type="xsd:anyURI"/>
      <xsd:element name="img2" type="xsd:anyURI"/>
      <xsd:element name="img3" type="xsd:anyURI"/>
      <xsd:element name="sec8" type="xsd:boolean"/>
      <xsd:element name="pets" type="xsd:string"/> <!-- dogs, cats, call, or site's value -->
      <xsd:element name="garage" type="xsd:string"/> <!-- available garage; i.e. 1 car, 2 car, etc -->
      <xsd:element name="amenities" type="xsd:string"/> <!-- comma delimited amenities -->
      <xsd:element name="includes" type="xsd:string"/> <!-- comma delimited - what's included in rent's price -->
      <xsd:element name="furnished" type="xsd:boolean"/>
    </xsd:sequence>
  </xsd:complexType>

  <!-- TYPE DEFINITIONS -->  

  <xsd:simpleType name="marketType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="R|A|C|S"/> <!-- 'R'ental, 'A'partment community, 'C'orporate Housig, 'S'enior -->
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="actionType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="U|D"/> <!-- 'U'pdate, 'D'elete -->
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="addressType">
    <xsd:sequence>
      <xsd:element name="line1" type="xsd:string"/> <!-- Street address; i.e. 11 Main Street -->
      <xsd:element name="line2" type="xsd:string"/> <!-- Optional unit number; i.e. #243 -->
      <xsd:element name="city" type="xsd:string"/> <!-- City name -->
      <xsd:element name="province" type="xsd:string"/> <!-- Full name or code; i.e. CO|colorado -->
      <xsd:element name="postal" type="xsd:string"/> <!-- Postal zip code; i.e. US 5 digit -->
      <xsd:element name="country" type="xsd:string"/> <!-- Two letter contry code; i.e. US -->
    </xsd:sequence>
  </xsd:complexType>

  <xsd:simpleType name="propType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="H|T|A|C|S|D|L"/> <!-- 'H'ouse, 'T'ownhouse, 'A'partment, 'C'ondo, 'S'tudio, 'V'illa, 'D'uplex, 'L'oft -->
    </xsd:restriction>
  </xsd:simpleType>
  
  <xsd:simpleType name="sqAreaType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="f|m"/> <!-- feet or meeters -->
    </xsd:restriction>
  </xsd:simpleType>
  
</xsd:schema>