<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="https://bim.house/spec/webpro-xml/v1"
           targetNamespace="https://bim.house/spec/webpro-xml/v1"
           elementFormDefault="qualified"
           version="1.0.0">

  <xs:annotation><xs:documentation>
    μBIM → WEBPRO 互換 入力 XML スキーマ
    建築研究所 WEBPRO 住宅版 v3.x 互換、μBIM v1 から自動生成。
  </xs:documentation></xs:annotation>

  <xs:element name="WebproInput">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="ProjectInfo" type="ProjectInfoType"/>
        <xs:element name="Envelope" type="EnvelopeType"/>
        <xs:element name="Equipment" type="EquipmentType"/>
        <xs:element name="Result" type="ResultType"/>
      </xs:sequence>
      <xs:attribute name="webproVersion" type="xs:string" use="required"/>
      <xs:attribute name="building_type" use="required">
        <xs:simpleType><xs:restriction base="xs:string">
          <xs:enumeration value="house_detached"/>
          <xs:enumeration value="house_attached"/>
          <xs:enumeration value="apartment"/>
        </xs:restriction></xs:simpleType>
      </xs:attribute>
      <xs:attribute name="generated_by" type="xs:string"/>
      <xs:attribute name="source_uri" type="xs:anyURI"/>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="ProjectInfoType">
    <xs:sequence>
      <xs:element name="Address" type="xs:string"/>
      <xs:element name="ClimateZoneMeti">
        <xs:simpleType><xs:restriction base="xs:integer">
          <xs:minInclusive value="1"/><xs:maxInclusive value="8"/>
        </xs:restriction></xs:simpleType>
      </xs:element>
      <xs:element name="FloorArea" type="xs:decimal"/>
      <xs:element name="Floors" type="xs:nonNegativeInteger"/>
      <xs:element name="Calculation_Method" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="EnvelopeType">
    <xs:sequence>
      <xs:element name="UA_Value" type="xs:decimal"/>
      <xs:element name="Eta_AC" type="xs:decimal"/>
      <xs:element name="ExteriorWallAreaM2" type="xs:decimal"/>
      <xs:element name="RoofAreaM2" type="xs:decimal"/>
      <xs:element name="FloorAreaM2" type="xs:decimal"/>
      <xs:element name="WindowAreaM2" type="xs:decimal"/>
      <xs:element name="DoorAreaM2" type="xs:decimal"/>
      <xs:element name="WallInsulation" type="InsulationType"/>
      <xs:element name="RoofInsulation" type="InsulationType"/>
      <xs:element name="FloorInsulation" type="InsulationType"/>
      <xs:element name="Window">
        <xs:complexType><xs:sequence>
          <xs:element name="Frame" type="xs:string"/>
          <xs:element name="Glass" type="xs:string"/>
          <xs:element name="Uw_Value" type="xs:decimal"/>
          <xs:element name="Eta_d" type="xs:decimal"/>
        </xs:sequence></xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="InsulationType">
    <xs:sequence>
      <xs:element name="Material" type="xs:string"/>
      <xs:element name="ThicknessMm" type="xs:nonNegativeInteger"/>
      <xs:element name="Lambda_WmK" type="xs:decimal"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="EquipmentType">
    <xs:sequence>
      <xs:element name="Heating"><xs:complexType><xs:sequence>
        <xs:element name="Type" type="xs:string"/>
        <xs:element name="APF" type="xs:decimal"/>
      </xs:sequence></xs:complexType></xs:element>
      <xs:element name="Cooling"><xs:complexType><xs:sequence>
        <xs:element name="Type" type="xs:string"/>
        <xs:element name="APF" type="xs:decimal"/>
      </xs:sequence></xs:complexType></xs:element>
      <xs:element name="Ventilation"><xs:complexType><xs:sequence>
        <xs:element name="Type" type="xs:string"/>
        <xs:element name="Volume_M3H" type="xs:decimal"/>
      </xs:sequence></xs:complexType></xs:element>
      <xs:element name="HotWater"><xs:complexType><xs:sequence>
        <xs:element name="Type" type="xs:string"/>
        <xs:element name="COP" type="xs:decimal"/>
        <xs:element name="Tank_L" type="xs:nonNegativeInteger"/>
      </xs:sequence></xs:complexType></xs:element>
      <xs:element name="Lighting"><xs:complexType><xs:sequence>
        <xs:element name="Type" type="xs:string"/>
      </xs:sequence></xs:complexType></xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ResultType">
    <xs:sequence>
      <xs:element name="PrimaryEnergyDesignGJ" type="xs:decimal"/>
      <xs:element name="PrimaryEnergyBaseGJ" type="xs:decimal"/>
      <xs:element name="BEI" type="xs:decimal"/>
      <xs:element name="UA_RequirementMet" type="xs:boolean"/>
      <xs:element name="Eta_AC_RequirementMet" type="xs:boolean"/>
      <xs:element name="BEI_RequirementMet" type="xs:boolean"/>
      <xs:element name="CertificationLevel">
        <xs:simpleType><xs:restriction base="xs:string">
          <xs:enumeration value="ZEH"/>
          <xs:enumeration value="ZEH_Oriented"/>
          <xs:enumeration value="ShoenetuKyu5"/>
          <xs:enumeration value="ShoenetuKyu4"/>
        </xs:restriction></xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>