/**
 * 企业微信模板配置表单
 */
import React from 'react';
import { Label } from '@/components/ui/label';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import type { TemplateConfigComponentProps } from '../template-config-strategies/types';

export const WeworkTemplateConfigForm: React.FC<TemplateConfigComponentProps> = ({
  register,
  errors,
  setValue,
  configState,
}) => {
  const currentValue = configState?.messageType || 'TEXT';
  
  return (
    <div className="space-y-4">
      <div>
        <Label htmlFor="messageType">消息类型</Label>
        <Select
          value={currentValue}
          onValueChange={(value) => setValue('templateConfig.messageType', value)}
        >
          <SelectTrigger>
            <SelectValue placeholder="选择消息类型" />
          </SelectTrigger>
          <SelectContent>
            <SelectItem value="TEXT">文本消息</SelectItem>
            <SelectItem value="MARKDOWN">Markdown消息</SelectItem>
            <SelectItem value="FILE">文件消息</SelectItem>
          </SelectContent>
        </Select>
        {errors?.templateConfig?.messageType && (
          <p className="text-sm text-destructive mt-1">
            {errors.templateConfig.messageType.message}
          </p>
        )}
      </div>
    </div>
  );
};
