<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="AKUZ" 
Name="DEVICE_SCHEDULE" 
Description="Расписание работы аппарата" 
PrimaryKey="DeviceScheduleID">
  <Fields>
    <Attribute Name="DeviceScheduleID" Type="guid" Description="Идентификатор" />
    <Choice Name="Day" Description="День недели">
      <Item Name="Понедельник" Index="1" />
      <Item Name="Вторник" Index="2" />
      <Item Name="Среда" Index="3" />
      <Item Name="Четверг" Index="4" />
      <Item Name="Пятница" Index="5" />
      <Item Name="Суббота" Index="6" />
      <Item Name="Воскресенье" Index="7" />
    </Choice>
    <Child Name="DeviceScheduleElements" Type="AKUZ.DEVICE_SCHEDULE_ELEMENT" Description="Элемент расписания аппарата" ChildAttribute="DeviceSchedule" />
    <Parent Name="DeviceScheduleList" Type="AKUZ.DEVICE_SCHEDULE_LIST" Description="Список с расписанием аппаратов" />
  </Fields>
  <DbMapping>
    <Table name="T_DEVICE_SCHEDULE">
      <Map Name="DeviceScheduleID" Column="DeviceScheduleID" />
      <Map Name="Day" Column="Day" />
      <Map Name="DeviceScheduleList" Column="DeviceScheduleList" />
    </Table>
  </DbMapping>
  <CalculatingAttributes>
    <Attribute Name="TimeSummary" Type="string" Description="Время работы" RequiredAttributes="{Day};{DeviceScheduleElements/FullTime};{DeviceScheduleElements};{DeviceScheduleElements/DeviceSchedule/Day}" />
  </CalculatingAttributes>
</Entity>