import { BackgroundStyle } from '../common/Common';
import { DeepPartial, PartiallyConstructible } from '../../utils';
import { IconStyle } from '../common/Common';
import { StyledText } from '../common/Common';

/**
Configuration of the hint guiding users through the scanning process.
*/
export class UserGuidanceConfiguration extends PartiallyConstructible {
  /**
    Determines whether the user guidance is visible or not.
    Default is true
    */
  public visible: boolean = true;
  /**
    The title of the user guidance.
    */
  public title: StyledText = new StyledText({ color: '?sbColorOnPrimary' });
  /**
    The background style used for the user guidance.
    */
  public background: BackgroundStyle = new BackgroundStyle({
    strokeColor: '#00000000',
    fillColor: '?sbColorSurfaceLow',
  });

  /** @param source {@displayType `DeepPartial<UserGuidanceConfiguration>`} */
  public constructor(source: DeepPartial<UserGuidanceConfiguration> = {}) {
    super();
    if (source.visible !== undefined) {
      this.visible = source.visible;
    }
    if (source.title !== undefined) {
      this.title = new StyledText(source.title);
    }
    if (source.background !== undefined) {
      this.background = new BackgroundStyle(source.background);
    }
  }
}

/**
Configuration of the hint (containing an icon) guiding users through the scanning process.
*/
export class IconUserGuidanceConfiguration extends PartiallyConstructible {
  /**
    Determines whether the user guidance is visible or not.
    Default is true
    */
  public visible: boolean = true;
  /**
    Configuration of the icon appearance.
    */
  public icon: IconStyle = new IconStyle({ color: '?sbColorOnPrimary' });
  /**
    The title of the user guidance.
    */
  public title: StyledText = new StyledText({ color: '?sbColorOnPrimary' });
  /**
    Configuration of the background appearance for the user guidance hints.
    */
  public background: BackgroundStyle = new BackgroundStyle({ fillColor: '?sbColorSurfaceLow' });

  /** @param source {@displayType `DeepPartial<IconUserGuidanceConfiguration>`} */
  public constructor(source: DeepPartial<IconUserGuidanceConfiguration> = {}) {
    super();
    if (source.visible !== undefined) {
      this.visible = source.visible;
    }
    if (source.icon !== undefined) {
      this.icon = new IconStyle(source.icon);
    }
    if (source.title !== undefined) {
      this.title = new StyledText(source.title);
    }
    if (source.background !== undefined) {
      this.background = new BackgroundStyle(source.background);
    }
  }
}
