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

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

export class CheckboxStrategy extends BaseFieldStrategy {
  supportsReadonly = false;

  render(context: FieldRenderContext): React.ReactNode {
    const { field, value, onChange, options } = context;
    const disabledProps = this.getDisabledProps(context);
    
    return (
      <Checkbox.Group
        {...disabledProps}
        options={options}
        value={value}
        onChange={onChange}
        style={{
          display: 'flex',
          flexDirection: field.checkboxLayout === 'vertical' ? 'column' : 'row',
          gap: field.checkboxLayout === 'vertical' ? '8px' : '16px',
        }}
      />
    );
  }
}

