// Copyright 2017-2024, University of Colorado Boulder

/**
 * LetterKeyNode is a TextKeyNode with layout and spacing defaults that look best for a single letter. A letter key is
 * square and that looks best for a single character.
 *
 * @author Jesse Greenberg (PhET Interactive Simulations)
 */

import { string_scenery_phet_key_a_StringProperty } from '../strings/key/a.js';
import { string_scenery_phet_key_c_StringProperty } from '../strings/key/c.js';
import { string_scenery_phet_key_d_StringProperty } from '../strings/key/d.js';
import { string_scenery_phet_key_l_StringProperty } from '../strings/key/l.js';
import { string_scenery_phet_key_r_StringProperty } from '../strings/key/r.js';
import { string_scenery_phet_key_s_StringProperty } from '../strings/key/s.js';
import { string_scenery_phet_key_w_StringProperty } from '../strings/key/w.js';
import { string_scenery_phet_key_one_StringProperty } from '../strings/key/one.js';
import { string_scenery_phet_key_two_StringProperty } from '../strings/key/two.js';
import { string_scenery_phet_key_three_StringProperty } from '../strings/key/three.js';
import '../../../globals.js';
import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import optionize, { EmptySelfOptions } from '../../../phet-core/js/optionize.js';
import StrictOmit from '../../../phet-core/js/types/StrictOmit.js';
import sceneryPhet from '../sceneryPhet.js';
import KeyNode from './KeyNode.js';
import TextKeyNode, { TextKeyNodeOptions } from './TextKeyNode.js';

type SelfOptions = EmptySelfOptions;

export type LetterKeyNodeOptions = SelfOptions & StrictOmit<TextKeyNodeOptions, 'forceSquareKey'>;

export default class LetterKeyNode extends TextKeyNode {

  public constructor( letter: string | TReadOnlyProperty<string>, providedOptions?: LetterKeyNodeOptions ) {
    const options = optionize<LetterKeyNodeOptions, SelfOptions, TextKeyNodeOptions>()( {
      xPadding: 5,
      forceSquareKey: true
    }, providedOptions );

    super( letter, options );
  }

  //-------------------------------------------------------------------------------------------------
  // Static factory methods for specific letter key strings.
  //-------------------------------------------------------------------------------------------------

  public static a( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_a_StringProperty, providedOptions );
  }

  public static c( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_c_StringProperty, providedOptions );
  }

  public static d( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_d_StringProperty, providedOptions );
  }

  public static l( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_l_StringProperty, providedOptions );
  }

  public static r( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_r_StringProperty, providedOptions );
  }

  public static s( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_s_StringProperty, providedOptions );
  }

  public static w( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_w_StringProperty, providedOptions );
  }

  public static one( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_one_StringProperty, providedOptions );
  }

  public static two( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_two_StringProperty, providedOptions );
  }

  public static three( providedOptions?: LetterKeyNodeOptions ): KeyNode {
    return new LetterKeyNode( string_scenery_phet_key_three_StringProperty, providedOptions );
  }
}

sceneryPhet.register( 'LetterKeyNode', LetterKeyNode );