export function soundCategory({ hasSpeaker = false } = {}) {
  const contents = [];

  if (hasSpeaker) {
    contents.push(
      {
        kind: 'block',
        type: 'sound_play_tone_speaker',
        inputs: {
          FREQ: { shadow: { type: 'math_number', fields: { NUM: 440 } } },
          DURATION: { shadow: { type: 'math_number', fields: { NUM: 500 } } },
        },
      },
      { kind: 'block', type: 'sound_stop_speaker' },
    );
  }

  contents.push(
    {
      kind: 'block',
      type: 'sound_play_tone',
      inputs: {
        FREQ: { shadow: { type: 'math_number', fields: { NUM: 440 } } },
        DURATION: { shadow: { type: 'math_number', fields: { NUM: 500 } } },
      },
    },
    { kind: 'block', type: 'sound_stop' },
  );

  return {
    kind: 'category',
    name: 'Sound',
    colour: '300',
    contents,
  };
}
