<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" >

  <xs:include schemaLocation="BaseType.xsd"></xs:include>
  
  <xs:element name="Admin" type="baseAdminType"  >
    
    <xs:unique name="GlobalUniqueness">
      <xs:selector xpath="*/*|Hidden/*/*" />
      <xs:field xpath="@id" />
    </xs:unique>

    <xs:unique name="AgentAccountUniqueness">
      <xs:annotation>
        <xs:appinfo>
          <NotAKey></NotAKey>
        </xs:appinfo>
      </xs:annotation>
      <xs:selector xpath="Agents/Agent/Account" />
      <xs:field xpath="." />
    </xs:unique>

    <xs:unique name="ActivitiesLanguagesUniqueness">
      <xs:selector xpath="ActivitiesLanguages/ActivityLanguage" />
      <xs:field xpath="@activityid" />
      <xs:field xpath="@languageid" />
    </xs:unique>

    <xs:unique name="QualificationsExclusionsUniqueness">
      <xs:selector xpath="QualificationsExclusions/QualificationExclusion" />
      <xs:field xpath="@activityid" />
      <xs:field xpath="@qualificationid" />
    </xs:unique>

    <xs:unique name="ActivitiesSkillsUniqueness">
      <xs:selector xpath="ActivitiesSkills/ActivitySkill" />
      <xs:field xpath="@activityid" />
      <xs:field xpath="@skillid" />
    </xs:unique>

    <xs:unique name="AppointmentsRelationsUniqueness">
      <xs:selector xpath="AppointmentsRelations/AppointmentsRelation" />
      <xs:field xpath="@appointmentsmemberid" />
      <xs:field xpath="@appointmentsareaid" />
    </xs:unique>

    <xs:unique name="DynamicParameterLinksUniqueness">
      <xs:selector xpath="DynamicParameterLinks/DynamicParameterLink" />
      <xs:field xpath="@adminobjectid" />
      <xs:field xpath="@dynamicparameterdefinitionid" />
    </xs:unique>

    <xs:unique name="AgentsLanguagesUniqueness">
      <xs:selector xpath="AgentsLanguages/AgentLanguage" />
      <xs:field xpath="@agentid" />
      <xs:field xpath="@languageid" />
    </xs:unique>

    <xs:unique name="AgentsSkillsUniqueness">
      <xs:selector xpath="AgentsSkills/AgentSkill" />
      <xs:field xpath="@agentid" />
      <xs:field xpath="@skillid" />
    </xs:unique>

    <xs:unique name="AgentsTeamsUniqueness">
      <xs:selector xpath="AgentsTeams/AgentTeam" />
      <xs:field xpath="@agentid" />
      <xs:field xpath="@teamid" />
    </xs:unique>

    <xs:unique name="InboundActivityTimeSpanActionsUniqueness">
      <xs:selector xpath="InboundActivityTimeSpanActions/InboundActivityTimeSpanAction" />
      <xs:field xpath="@planningtimespanid" />
      <xs:field xpath="@inboundactivityid" />
    </xs:unique>

    <xs:unique name="InboundActivitySpecialDayActionsUniqueness">
      <xs:selector xpath="InboundActivitySpecialDayActions/InboundActivitySpecialDayAction" />
      <xs:field xpath="@specialdayid" />
      <xs:field xpath="@inboundactivityid" />
    </xs:unique>

    <xs:unique name="OutboundActivityTimeSpanActionsUniqueness">
      <xs:selector xpath="OutboundActivityTimeSpanActions/OutboundActivityTimeSpanAction" />
      <xs:field xpath="@planningtimespanid" />
      <xs:field xpath="@outboundactivityid" />
    </xs:unique>

    <xs:unique name="OutboundActivitySpecialDayActionsUniqueness">
      <xs:selector xpath="OutboundActivitySpecialDayActions/OutboundActivitySpecialDayAction" />
      <xs:field xpath="@specialdayid" />
      <xs:field xpath="@outboundactivityid" />
    </xs:unique>

    <xs:unique name="LocationCostsUniqueness">
      <xs:selector xpath="LocationCosts/LocationCost" />
      <xs:field xpath="@fromlocation" />
      <xs:field xpath="@tolocation" />
    </xs:unique>

    <xs:unique name="ObjectsSecurityUniqueness">
      <xs:selector xpath="ObjectsSecurity/ObjectSecurity" />
      <xs:field xpath="@securedadminobjectid" />
      <xs:field xpath="@roleid" />
      <xs:field xpath="@rightid" />
    </xs:unique>

    <xs:unique name="PromptsLinksUniqueness">
      <xs:selector xpath="PromptsLinks/PromptLink" />
      <xs:field xpath="@promptid" />
      <xs:field xpath="@adminobjectid" />
    </xs:unique>

    <xs:unique name="ResourcesCarriersUniqueness">
      <xs:selector xpath="ResourcesCarriers/ResourceCarrier" />
      <xs:field xpath="@resourceid" />
      <xs:field xpath="@carrierid" />
    </xs:unique>

    <xs:unique name="RoleMembersUniqueness">
      <xs:selector xpath="RoleMembers/RoleMember" />
      <xs:field xpath="@agentid" />
      <xs:field xpath="@roleid" />
    </xs:unique>

    <xs:unique name="QueuesTeamsUniqueness">
      <xs:selector xpath="QueuesTeams/QueueTeam" />
      <xs:field xpath="@queueid" />
      <xs:field xpath="@teamid" />
    </xs:unique>

    <xs:unique name="CallbackRulesUniqueness">
      <xs:selector xpath="CallbackRules/CallbackRule" />
      <xs:field xpath="@callbackrulesetid" />
      <xs:field xpath="@sequenceid" />           
    </xs:unique>

    <xs:unique name="DynamicParameterListItemsUniqueness">
      <xs:selector xpath="DynamicParameterListItems/DynamicParameterListItem" />
      <xs:field xpath="@listid" />
      <xs:field xpath="@sequenceid" />
    </xs:unique>


    <xs:unique name="AddressBookEntriesUniqueness">
      <xs:selector xpath="AddressBookEntries/AddressBookEntry" />
      <xs:field xpath="@addressbookid" />
      <xs:field xpath="@sequenceid" />
    </xs:unique>

    <xs:unique name="PromptsShortCodesUniqueness">
      <xs:annotation>
        <xs:appinfo>
          <NotAKey></NotAKey>
        </xs:appinfo>
      </xs:annotation>
      <xs:selector xpath="Prompts/Prompt/ShortCode|Prompts/Prompt/RelatedPrompts/Prompt/ShortCode" />
      <xs:field xpath="." />
    </xs:unique>

  </xs:element>

</xs:schema>

