// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_LIVE_CAPTION_PREF_NAMES_H_
#define COMPONENTS_LIVE_CAPTION_PREF_NAMES_H_

#include <string>

#include "build/build_config.h"

#if !BUILDFLAG(IS_ANDROID)
#include "components/soda/constants.h"
#endif

class PrefService;

namespace prefs {

// Live Caption is not available on Android, so exclude these unneeded
// kLiveCaption*  prefs.
#if !defined(ANDROID)
// Whether the Live Caption bubble is expanded.
inline constexpr char kLiveCaptionBubbleExpanded[] =
    "accessibility.captions.live_caption_bubble_expanded";

// Whether the Live Caption feature is enabled.
inline constexpr char kLiveCaptionEnabled[] =
    "accessibility.captions.live_caption_enabled";

// The language to use with the Live Caption feature.
inline constexpr char kLiveCaptionLanguageCode[] =
    "accessibility.captions.live_caption_language";

// Whether offensive words are masked.
inline constexpr char kLiveCaptionMaskOffensiveWords[] =
    "accessibility.captions.live_caption_mask_offensive_words";

// The list of origins that should not display an error message when using the
// Media Foundation renderer.
inline constexpr char kLiveCaptionMediaFoundationRendererErrorSilenced[] =
    "accessibility.captions.live_caption_media_foundation_renderer_error_"
    "silenced";

// Whether the Headless Caption exploration is enabled.  Unlike
// `kLiveCaptionEnabled`, this does not imply that the UI is visible.  Both
// prefs may be enabled at once.
inline constexpr char kHeadlessCaptionEnabled[] =
    "accessibility.captions.headless_caption_enabled";

// The file path of the Speech Recognition Small Expert Model.
inline constexpr char kSpeechRecognitionSmallExpertModelPath[] =
    "accessibility.captions.speech_recognition_small_expert_model_path";

const std::string GetLiveCaptionLanguageCode(PrefService* profile_prefs);
bool IsLanguageCodeForLiveCaption(speech::LanguageCode language_code,
                                  PrefService* profile_prefs);

#endif  // !defined(ANDROID)

// These kAccessibilityCaptions* caption style prefs are used on Android
// (though their primary use is for Live Caption, which is why they are housed
// within this live_caption component instead of somewhere more generic).

// String indicating the size of the captions text as a percentage.
inline constexpr char kAccessibilityCaptionsTextSize[] =
    "accessibility.captions.text_size";

// String indicating the font of the captions text.
inline constexpr char kAccessibilityCaptionsTextFont[] =
    "accessibility.captions.text_font";

// Comma-separated string indicating the RGB values of the captions text color.
inline constexpr char kAccessibilityCaptionsTextColor[] =
    "accessibility.captions.text_color";

// Integer indicating the opacity of the captions text from 0 - 100.
inline constexpr char kAccessibilityCaptionsTextOpacity[] =
    "accessibility.captions.text_opacity";

// Comma-separated string indicating the RGB values of the background color.
inline constexpr char kAccessibilityCaptionsBackgroundColor[] =
    "accessibility.captions.background_color";

// CSS string indicating the shadow of the captions text.
inline constexpr char kAccessibilityCaptionsTextShadow[] =
    "accessibility.captions.text_shadow";

// Integer indicating the opacity of the captions text background from 0 - 100.
inline constexpr char kAccessibilityCaptionsBackgroundOpacity[] =
    "accessibility.captions.background_opacity";

// Live Translate prefs.

// Whether the Live Translate feature is enabled.
inline constexpr char kLiveTranslateEnabled[] =
    "accessibility.captions.live_translate_enabled";

// The target language to translate the captions to.
inline constexpr char kLiveTranslateTargetLanguageCode[] =
    "accessibility.captions.live_translate_target_language";

}  // namespace prefs

#endif  // COMPONENTS_LIVE_CAPTION_PREF_NAMES_H_
