using System;
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.Mvc;

using CommonHelpers;

namespace BookRegistry.Server {

//**************************************************************************************************
[ApiController]
public partial class GeneralApiResponseController: XControllerBase {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[HAsyncStatic][HThreadStatic]
public static void ApplyQueryArgsToContext(ApiArgumentsBase? queryArgs)
{
   var ctx = new QueryContext();
   string? lang = queryArgs?.query_Language;
   ctx.Language = lang;
   QueryContext.Assign( ctx );
   if ( lang != null )
      LocaleHlp.UseLanguage( lang );
   else
      LocaleHlp.UpdateCulture();
}

//==================================================================================================

static Func<string,GeneralApiResponse> CreateErrorResponseCallback =>
   GeneralApiResponse.CreateServerError;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // GeneralApiResponseController
//**************************************************************************************************

} // BookRegistry.Server
