<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
  <edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/Common.xml">
    <edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
  </edmx:Reference>
  <edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
    <edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
  </edmx:Reference>
  <edmx:DataServices>
    <Schema Namespace="LoginAuditService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <EntityContainer Name="EntityContainer">
        <EntitySet Name="LoginAuditTrail" EntityType="LoginAuditService.LoginAuditTrail"/>
        <EntitySet Name="Users" EntityType="LoginAuditService.Users"/>
        <EntitySet Name="SuccessfulLogins" EntityType="LoginAuditService.SuccessfulLogins"/>
        <EntitySet Name="FailedLoginAttempts" EntityType="LoginAuditService.FailedLoginAttempts"/>
        <EntitySet Name="AccountLockouts" EntityType="LoginAuditService.AccountLockouts"/>
        <EntitySet Name="PasswordEvents" EntityType="LoginAuditService.PasswordEvents"/>
        <FunctionImport Name="getLoginAuditTrail" Function="LoginAuditService.getLoginAuditTrail"/>
        <FunctionImport Name="getUserLoginHistory" Function="LoginAuditService.getUserLoginHistory"/>
        <FunctionImport Name="isAccountLocked" Function="LoginAuditService.isAccountLocked"/>
        <FunctionImport Name="getFailedLoginCount" Function="LoginAuditService.getFailedLoginCount"/>
        <FunctionImport Name="getLoginStatistics" Function="LoginAuditService.getLoginStatistics"/>
        <FunctionImport Name="getSuspiciousActivity" Function="LoginAuditService.getSuspiciousActivity"/>
        <FunctionImport Name="exportLoginAuditLogs" Function="LoginAuditService.exportLoginAuditLogs"/>
      </EntityContainer>
      <EntityType Name="LoginAuditTrail">
        <Key>
          <PropertyRef Name="ID"/>
        </Key>
        <Property Name="ID" Type="Edm.Guid" Nullable="false"/>
        <Property Name="action" Type="Edm.String" MaxLength="50"/>
        <Property Name="user_id" Type="Edm.String" MaxLength="36" Nullable="false"/>
        <Property Name="username" Type="Edm.String" MaxLength="100" Nullable="false"/>
        <Property Name="email" Type="Edm.String" MaxLength="100"/>
        <Property Name="ip_address" Type="Edm.String" MaxLength="45"/>
        <Property Name="device_info" Type="Edm.String" MaxLength="255"/>
        <Property Name="user_agent" Type="Edm.String" MaxLength="500"/>
        <Property Name="hostname" Type="Edm.String" MaxLength="100"/>
        <Property Name="description" Type="Edm.String" MaxLength="1000"/>
        <Property Name="attempt_number" Type="Edm.Int32"/>
        <Property Name="lockout_duration" Type="Edm.Int32"/>
        <Property Name="failure_reason" Type="Edm.String" MaxLength="255"/>
        <Property Name="verification_method" Type="Edm.String" MaxLength="100"/>
        <Property Name="change_initiator" Type="Edm.String" MaxLength="100"/>
        <Property Name="timestamp" Type="Edm.DateTimeOffset" Precision="7" Nullable="false"/>
        <Property Name="created_at" Type="Edm.DateTimeOffset" Precision="7"/>
      </EntityType>
      <EntityType Name="Users">
        <Key>
          <PropertyRef Name="ID"/>
        </Key>
        <Property Name="ID" Type="Edm.Guid" Nullable="false"/>
        <Property Name="username" Type="Edm.String" MaxLength="100" Nullable="false"/>
        <Property Name="firstName" Type="Edm.String" MaxLength="32" Nullable="false"/>
        <Property Name="created_at" Type="Edm.DateTimeOffset" Precision="7"/>
        <Property Name="updated_at" Type="Edm.DateTimeOffset" Precision="7"/>
      </EntityType>
      <EntityType Name="SuccessfulLogins">
        <Property Name="user_id" Type="Edm.String" MaxLength="36" Nullable="false"/>
        <Property Name="username" Type="Edm.String" MaxLength="100" Nullable="false"/>
        <Property Name="ip_address" Type="Edm.String" MaxLength="45"/>
        <Property Name="timestamp" Type="Edm.DateTimeOffset" Precision="7" Nullable="false"/>
        <Property Name="login_count" Type="Edm.Int32"/>
      </EntityType>
      <EntityType Name="FailedLoginAttempts">
        <Property Name="user_id" Type="Edm.String" MaxLength="36" Nullable="false"/>
        <Property Name="username" Type="Edm.String" MaxLength="100" Nullable="false"/>
        <Property Name="ip_address" Type="Edm.String" MaxLength="45"/>
        <Property Name="attempt_number" Type="Edm.Int32"/>
        <Property Name="failure_reason" Type="Edm.String" MaxLength="255"/>
        <Property Name="timestamp" Type="Edm.DateTimeOffset" Precision="7" Nullable="false"/>
        <Property Name="total_attempts" Type="Edm.Int32"/>
      </EntityType>
      <EntityType Name="AccountLockouts">
        <Property Name="user_id" Type="Edm.String" MaxLength="36" Nullable="false"/>
        <Property Name="username" Type="Edm.String" MaxLength="100" Nullable="false"/>
        <Property Name="ip_address" Type="Edm.String" MaxLength="45"/>
        <Property Name="lockout_duration" Type="Edm.Int32"/>
        <Property Name="timestamp" Type="Edm.DateTimeOffset" Precision="7" Nullable="false"/>
      </EntityType>
      <EntityType Name="PasswordEvents">
        <Property Name="user_id" Type="Edm.String" MaxLength="36" Nullable="false"/>
        <Property Name="username" Type="Edm.String" MaxLength="100" Nullable="false"/>
        <Property Name="action" Type="Edm.String" MaxLength="50"/>
        <Property Name="change_initiator" Type="Edm.String" MaxLength="100"/>
        <Property Name="verification_method" Type="Edm.String" MaxLength="100"/>
        <Property Name="timestamp" Type="Edm.DateTimeOffset" Precision="7" Nullable="false"/>
      </EntityType>
      <ComplexType Name="return_LoginAuditService_getLoginAuditTrail">
        <Property Name="ID" Type="Edm.Guid"/>
        <Property Name="action" Type="Edm.String"/>
        <Property Name="user_id" Type="Edm.String"/>
        <Property Name="username" Type="Edm.String"/>
        <Property Name="email" Type="Edm.String"/>
        <Property Name="ip_address" Type="Edm.String"/>
        <Property Name="device_info" Type="Edm.String"/>
        <Property Name="user_agent" Type="Edm.String"/>
        <Property Name="description" Type="Edm.String"/>
        <Property Name="attempt_number" Type="Edm.Int32"/>
        <Property Name="failure_reason" Type="Edm.String"/>
        <Property Name="timestamp" Type="Edm.DateTimeOffset" Precision="7"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_getUserLoginHistory">
        <Property Name="action" Type="Edm.String"/>
        <Property Name="description" Type="Edm.String"/>
        <Property Name="ip_address" Type="Edm.String"/>
        <Property Name="device_info" Type="Edm.String"/>
        <Property Name="attempt_number" Type="Edm.Int32"/>
        <Property Name="failure_reason" Type="Edm.String"/>
        <Property Name="timestamp" Type="Edm.DateTimeOffset" Precision="7"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_isAccountLocked">
        <Property Name="locked" Type="Edm.Boolean"/>
        <Property Name="locked_since" Type="Edm.DateTimeOffset" Precision="7"/>
        <Property Name="lockout_ends" Type="Edm.DateTimeOffset" Precision="7"/>
        <Property Name="lockout_duration" Type="Edm.Int32"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_getFailedLoginCount">
        <Property Name="count" Type="Edm.Int32"/>
        <Property Name="attempts" Type="Collection(LoginAuditService.return_LoginAuditService_getFailedLoginCount_attempts)" Nullable="false"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_getFailedLoginCount_attempts">
        <Property Name="timestamp" Type="Edm.DateTimeOffset" Precision="7"/>
        <Property Name="ip_address" Type="Edm.String"/>
        <Property Name="device_info" Type="Edm.String"/>
        <Property Name="failure_reason" Type="Edm.String"/>
        <Property Name="attempt_number" Type="Edm.Int32"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_getLoginStatistics">
        <Property Name="total_events" Type="Edm.Int32"/>
        <Property Name="successful_logins" Type="Edm.Int32"/>
        <Property Name="failed_login_attempts" Type="Edm.Int32"/>
        <Property Name="account_lockouts" Type="Edm.Int32"/>
        <Property Name="password_changes" Type="Edm.Int32"/>
        <Property Name="password_resets" Type="Edm.Int32"/>
        <Property Name="unique_users" Type="Edm.Int32"/>
        <Property Name="top_ip_addresses" Type="Collection(LoginAuditService.return_LoginAuditService_getLoginStatistics_top_ip_addresses)" Nullable="false"/>
        <Property Name="top_failed_users" Type="Collection(LoginAuditService.return_LoginAuditService_getLoginStatistics_top_failed_users)" Nullable="false"/>
        <Property Name="most_common_failures" Type="Collection(LoginAuditService.return_LoginAuditService_getLoginStatistics_most_common_failures)" Nullable="false"/>
        <Property Name="average_daily_events" Type="Edm.Decimal" Scale="variable"/>
        <Property Name="peak_login_hour" Type="Edm.Int32"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_getLoginStatistics_top_ip_addresses">
        <Property Name="ip" Type="Edm.String"/>
        <Property Name="count" Type="Edm.Int32"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_getLoginStatistics_top_failed_users">
        <Property Name="username" Type="Edm.String"/>
        <Property Name="count" Type="Edm.Int32"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_getLoginStatistics_most_common_failures">
        <Property Name="reason" Type="Edm.String"/>
        <Property Name="count" Type="Edm.Int32"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_getSuspiciousActivity">
        <Property Name="username" Type="Edm.String"/>
        <Property Name="user_id" Type="Edm.String"/>
        <Property Name="ip_address" Type="Edm.String"/>
        <Property Name="activity" Type="Edm.String"/>
        <Property Name="count" Type="Edm.Int32"/>
        <Property Name="last_seen" Type="Edm.DateTimeOffset" Precision="7"/>
      </ComplexType>
      <ComplexType Name="return_LoginAuditService_exportLoginAuditLogs">
        <Property Name="file_name" Type="Edm.String"/>
        <Property Name="file_size" Type="Edm.Int32"/>
        <Property Name="record_count" Type="Edm.Int32"/>
        <Property Name="export_time" Type="Edm.DateTimeOffset" Precision="7"/>
      </ComplexType>
      <Function Name="getLoginAuditTrail" IsBound="false" IsComposable="false">
        <Parameter Name="limit" Type="Edm.Int32"/>
        <Parameter Name="offset" Type="Edm.Int32"/>
        <ReturnType Type="Collection(LoginAuditService.return_LoginAuditService_getLoginAuditTrail)" Nullable="false"/>
      </Function>
      <Function Name="getUserLoginHistory" IsBound="false" IsComposable="false">
        <Parameter Name="username" Type="Edm.String"/>
        <Parameter Name="days" Type="Edm.Int32"/>
        <ReturnType Type="Collection(LoginAuditService.return_LoginAuditService_getUserLoginHistory)" Nullable="false"/>
      </Function>
      <Function Name="isAccountLocked" IsBound="false" IsComposable="false">
        <Parameter Name="username" Type="Edm.String"/>
        <ReturnType Type="LoginAuditService.return_LoginAuditService_isAccountLocked"/>
      </Function>
      <Function Name="getFailedLoginCount" IsBound="false" IsComposable="false">
        <Parameter Name="username" Type="Edm.String"/>
        <Parameter Name="hours" Type="Edm.Int32"/>
        <ReturnType Type="LoginAuditService.return_LoginAuditService_getFailedLoginCount"/>
      </Function>
      <Function Name="getLoginStatistics" IsBound="false" IsComposable="false">
        <Parameter Name="startDate" Type="Edm.Date"/>
        <Parameter Name="endDate" Type="Edm.Date"/>
        <ReturnType Type="LoginAuditService.return_LoginAuditService_getLoginStatistics"/>
      </Function>
      <Function Name="getSuspiciousActivity" IsBound="false" IsComposable="false">
        <Parameter Name="hours" Type="Edm.Int32"/>
        <Parameter Name="threshold" Type="Edm.Int32"/>
        <ReturnType Type="Collection(LoginAuditService.return_LoginAuditService_getSuspiciousActivity)" Nullable="false"/>
      </Function>
      <Function Name="exportLoginAuditLogs" IsBound="false" IsComposable="false">
        <Parameter Name="startDate" Type="Edm.Date"/>
        <Parameter Name="endDate" Type="Edm.Date"/>
        <Parameter Name="format" Type="Edm.String"/>
        <ReturnType Type="LoginAuditService.return_LoginAuditService_exportLoginAuditLogs"/>
      </Function>
      <Annotations Target="LoginAuditService.LoginAuditTrail/ID">
        <Annotation Term="Core.ComputedDefaultValue" Bool="true"/>
      </Annotations>
      <Annotations Target="LoginAuditService.Users/ID">
        <Annotation Term="Core.ComputedDefaultValue" Bool="true"/>
      </Annotations>
      <Annotations Target="LoginAuditService.Users/created_at">
        <Annotation Term="Core.Computed" Bool="true"/>
      </Annotations>
      <Annotations Target="LoginAuditService.Users/updated_at">
        <Annotation Term="Core.Computed" Bool="true"/>
      </Annotations>
      <Annotations Target="LoginAuditService.SuccessfulLogins/login_count">
        <Annotation Term="Core.Computed" Bool="true"/>
      </Annotations>
      <Annotations Target="LoginAuditService.FailedLoginAttempts/total_attempts">
        <Annotation Term="Core.Computed" Bool="true"/>
      </Annotations>
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>