class BackgroundMusic { private static readonly SUPPORTED = ['ambient', 'epic', 'scary', 'none']; private constructor(private readonly _value: string) {} static create(value: string): BackgroundMusic { if (!this.SUPPORTED.includes(value.toLowerCase())) { throw new Error(`Music not supported: ${value}`); } return new BackgroundMusic(value.toLowerCase()); } get value(): string { return this._value; } } class SoundEffect { private static readonly SUPPORTED = ['scream', 'whoosh', 'none']; private constructor(private readonly _value: string) {} static create(value: string): SoundEffect { if (!this.SUPPORTED.includes(value.toLowerCase())) { throw new Error(`Sound effect not supported: ${value}`); } return new SoundEffect(value.toLowerCase()); } get value(): string { return this._value; } } export interface MusicConfigProps { backgroundMusic: string; soundEffect: string; } export class MusicConfig { private constructor( public readonly backgroundMusic: BackgroundMusic, public readonly soundEffect: SoundEffect ) {} static create(props: MusicConfigProps): MusicConfig { return new MusicConfig( BackgroundMusic.create(props.backgroundMusic), SoundEffect.create(props.soundEffect) ); } static createDefault(): MusicConfig { return this.create({ backgroundMusic: 'none', soundEffect: 'none' }); } }