/***************************************************************************************************
# AUTHORIZATION (LOGIN QUERY ETC.):
# --------------------------------------------------------------------------------------------------
# Flat owner personal cabinet | MyFlat sample project | Author: Sergei Y.Kitáev
# -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/

/*==================================================================================================
# USER AUTHORIZATION:
# === Usage: ===
# exec @Возврат = [ЛК::Авторизация] -- authorization
#    @КодЛС = <Account code>, @КодДоступа = <User access code>,
#    @Статус = @<Status GUID variable> out, -- status
#    @Сообщение = @<Error message variable> out -- message
# === Possible errors (named statuses, upon main return code = 1): ===
:SetVar Status_ServiceNotAvailable        "'71F0A024-228F-4199-B2B9-0C70D912D0F1'"
:SetVar Status_AuthorizationNotPassed     "'7AD9B001-A3D2-4E3F-AD14-018D27742634'"
:SetVar Status_AccessNotOpen              "'0EDF636D-FDE1-4E07-9C15-6BB123B0DCF2'"
:SetVar Status_AccountNotFound            "'3BF5D1C7-AA30-410F-A9C0-358035C2A156'"
:SetVar Status_NewRegistrationRequired    "'64F1A24C-8F10-4A39-A9ED-92E18DBB0751'"
*/
procedure [ЛК::Авторизация] -- authorization
   @КодЛС         bigint,                          -- account code
   @КодДоступа    $(dt_AccessCode),                -- user access code
   @Сообщение     $(dt_Message_AUX) = null   out,  -- message
   @Статус        uniqueidentifier  = null   out   -- status
/*
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# === Result-set #1: ===
# [ИД ЛС]               uniqueidentifier  not null -- account ID
# [Код ЛС]              bigint            not null -- account code (human R/W as decimal number)
# [Дата регистрации]    datetime2         not null -- registration date (with time)
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# === Result-set #2: ===
# [ФИО]                 $(dt_String_RUH)  not null -- flat owner initials
# [Адрес]               $(dt_String_RUH)  not null -- flat address
# [Кол-во проживающих]  int               not null -- really live (person count)
# [Общая площадь]       $(dt_Square_2)    not null -- total flat territory square
# [Жилая площадь]       $(dt_Square_2)    not null -- living territory square
# [Название района]     $(dt_String_RUH)  not null -- district name
# [Название жил.орг.]   $(dt_String_RUH)  not null -- name of technical subdivision
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
