/**
 * Radio 字段渲染策略
 */

import React from 'react';
import { Radio } from 'antd';
import { BaseFieldStrategy } from './BaseFieldStrategy';
import type { FieldRenderContext } from '../IFieldRenderStrategy';

export class RadioStrategy extends BaseFieldStrategy {
  supportsReadonly = false;

  render(context: FieldRenderContext): React.ReactNode {
    const { value, onChange, options } = context;
    const disabledProps = this.getDisabledProps(context);
    
    return (
      <Radio.Group
        {...disabledProps}
        options={options}
        value={value}
        onChange={(e) => onChange?.(e.target.value)}
      />
    );
  }
}

