<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
  <edmx:DataServices>
    <Schema Namespace="DataScope.Select.Api.Jobs" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <EntityType Name="Job" HasStream="true" p4:OperationsDestination="Ancestor" xmlns:p4="DataScope.Select.Api.Jobs">
        <Key>
          <PropertyRef Name="JobId" />
        </Key>
        <Property Name="JobId" Type="Edm.String" Nullable="false" p4:KeyAnnotation="Key" />
        <Property Name="UserId" Type="Edm.Int32" Nullable="false" />
        <Property Name="Status" Type="DataScope.Select.Api.Jobs.JobStatus" Nullable="false" />
        <Property Name="StatusMessage" Type="Edm.String" />
        <Property Name="Description" Type="Edm.String" />
        <Property Name="ProgressPercentage" Type="Edm.Int32" />
        <Property Name="CreateDate" Type="Edm.DateTimeOffset" Nullable="false" p4:RequiredAnnotation="Required" />
        <Property Name="StartedDate" Type="Edm.DateTimeOffset" />
        <Property Name="CompletionDate" Type="Edm.DateTimeOffset" />
        <Property Name="MonitorUrl" Type="Edm.String" p4:IsReadOnly="true" />
        <Annotation Term="Org.OData.Core.V1.Description" String="Represents a the state of an asynchronous job." />
        <Annotation Term="Org.OData.Core.V1.LongDescription" String="The asynchronous mechanism is used for potentially long requests.  The toolkit defaults to allow asynchronous requests (provided the method being called supports it) while direct HTTP requests (not using the toolkit) default to disable asynchronous requests. Asynchronous requests are enabled using the prefer-async OData preferences header.  The toolkit always set this header. If the method supports asynchronous requests and the header is included, the server will respond with a 202 (accepted) if the response was found to be taking more than a few seconds.  The 202 response includes a MonitorUrl which can be polled until the results are returned.  Asynchronous jobs can be cancelled by submitting a DELETE to the MonitorUrl or calling context.Cancel(job) in the toolkit. Not all jobs support cancellation (405 returned) and once a job has past a certain point the cancellation will be rejected (400). See the examples for more information on monitoring and cancelling asynchronous jobs." />
      </EntityType>
      <EnumType Name="JobStatus">
        <Member Name="NotStarted" Value="0" />
        <Member Name="InProgress" Value="1" />
        <Member Name="Completed" Value="2" />
        <Member Name="Error" Value="3" />
        <Member Name="PendingCancellation" Value="4" />
        <Member Name="Cancelled" Value="5" />
        <Member Name="Purged" Value="6" />
      </EnumType>
      <Function Name="JobGetResult" IsBound="true">
        <Parameter Name="bindingParameter" Type="DataScope.Select.Api.Jobs.Job" />
        <ReturnType Type="System.Object" />
        <Annotation Term="Org.OData.Capabilities.V1.AsynchronousRequestsSupported" Bool="true" />
        <Annotation Term="Core.Description.Async" String="Service supports asynchronous request preference" />
        <Annotation Term="Org.OData.Core.V1.Description" String="Extracts long polling monitor status. This polls the job table every n seconds and returns to the client after m sec. If the job is complete the location URI changes based on the data for the corresponding job. Otherwise pending job status gets returned." />
        <Annotation Term="Org.OData.Core.V1.LongDescription" String="" />
      </Function>
      <Function Name="JobGetActive">
        <ReturnType Type="Collection(DataScope.Select.Api.Jobs.Job)" />
        <Annotation Term="Org.OData.Capabilities.V1.Paging" Bool="true" />
      </Function>
      <Function Name="JobGetCompleted">
        <ReturnType Type="Collection(DataScope.Select.Api.Jobs.Job)" />
        <Annotation Term="Org.OData.Capabilities.V1.Paging" Bool="true" />
      </Function>
      <EntityContainer Name="Jobs">
        <EntitySet Name="Jobs" EntityType="DataScope.Select.Api.Jobs.Job" />
        <FunctionImport Name="JobGetActive" Function="DataScope.Select.Api.Jobs.JobGetActive" EntitySet="Jobs" IncludeInServiceDocument="true">
          <Annotation Term="Org.OData.Core.V1.Description" String="Returns the active (in flight jobs) for all asynchronous requests." />
          <Annotation Term="Org.OData.Core.V1.LongDescription" String="" />
        </FunctionImport>
        <FunctionImport Name="JobGetCompleted" Function="DataScope.Select.Api.Jobs.JobGetCompleted" EntitySet="Jobs" IncludeInServiceDocument="true">
          <Annotation Term="Org.OData.Core.V1.Description" String="Returns the active (in flight jobs) for all asynchronous requests." />
          <Annotation Term="Org.OData.Core.V1.LongDescription" String="" />
        </FunctionImport>
      </EntityContainer>
    </Schema>
    <Schema Namespace="System" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <ComplexType Name="Object" />
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>