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

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

export class SwitchStrategy extends BaseFieldStrategy {
  supportsReadonly = false;

  render(context: FieldRenderContext): React.ReactNode {
    const { value, onChange } = context;
    const disabledProps = this.getDisabledProps(context);
    
    return (
      <Switch
        {...disabledProps}
        checked={value}
        onChange={onChange}
      />
    );
  }
}

