/**
 * 企业微信配置表单组件
 */
import React from 'react';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import type { ConfigComponentProps } from '../config-strategies/types';

export const WeworkConfigForm: React.FC<ConfigComponentProps> = ({
  register,
  errors,
}) => {
  return (
    <>
      <div className="space-y-2">
        <Label htmlFor="key">
          Webhook Key <span className="text-destructive">*</span>
        </Label>
        <Input
          id="key"
          placeholder="例如：693a71f6-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
          {...register('config.key')}
        />
        <p className="text-xs text-muted-foreground">
          完整URL: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY
        </p>
        {errors.config?.key && (
          <p className="text-sm text-destructive">
            {errors.config.key.message}
          </p>
        )}
      </div>
    </>
  );
};
