class ImageModel { private static readonly SUPPORTED_MODELS = ['flux', 'ssd-1b', 'sdxl', 'api', 'local']; private constructor(private readonly _value: string) {} static create(value: string): ImageModel { if (!this.SUPPORTED_MODELS.includes(value.toLowerCase())) { throw new Error(`Model not supported: ${value}`); } return new ImageModel(value.toLowerCase()); } get value(): string { return this._value; } } class AspectRatio { private constructor(private readonly _value: string) {} static create(value: string): AspectRatio { const ratioRegex = /^\d+:\d+$/; if (!ratioRegex.test(value)) { throw new Error('Invalid Aspect Ratio format (expected W:H)'); } return new AspectRatio(value); } get value(): string { return this._value; } } class VisualStyle { private constructor(private readonly _value: string) {} static create(value: string): VisualStyle { if (!value || value.trim().length === 0) { throw new Error('Visual style cannot be empty'); } return new VisualStyle(value.trim().toLowerCase()); } get value(): string { return this._value; } } export interface VisualConfigProps { model: string; aspectRatio: string; style: string; } export class VisualConfig { private constructor( public readonly model: ImageModel, public readonly aspectRatio: AspectRatio, public readonly style: VisualStyle ) {} static create(props: VisualConfigProps): VisualConfig { return new VisualConfig( ImageModel.create(props.model), AspectRatio.create(props.aspectRatio), VisualStyle.create(props.style) ); } static createDefault(): VisualConfig { return this.create({ model: 'flux', aspectRatio: '9:16', style: 'anime' }); } }