/**
 * filekorolheader: 企业审核搜索筛选组件 - 搜索和筛选功能界面
 * 功能：关键词搜索、状态筛选、搜索功能实现
 * 路径：/central-config/tenant/enterprise-audit/components/AuditSearchAndFilter
 * 规范：遵循crop-x/docs/开发项目规范.md，使用shadcn/ui组件，TypeScript类型安全
 */

import { Card } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import { Search, RotateCcw } from 'lucide-react';

interface AuditSearchAndFilterProps {
  searchKeyword: string;
  onSearchChange: (keyword: string) => void;
  statusFilter: string;
  onStatusFilterChange: (status: string) => void;
  onRefresh: () => void;
  loading?: boolean;
}

export function AuditSearchAndFilter({
  searchKeyword,
  onSearchChange,
  statusFilter,
  onStatusFilterChange,
  onRefresh,
  loading = false
}: AuditSearchAndFilterProps) {
  return (
    <Card className="p-4">
      <div className="flex gap-4">
        <div className="flex-1">
          <div className="relative">
            <Search className="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground" />
            <Input
              placeholder="搜索企业名称、信用代码、登记人..."
              value={searchKeyword}
              onChange={(e) => onSearchChange(e.target.value)}
              className="pl-10"
            />
          </div>
        </div>
        <Select value={statusFilter} onValueChange={onStatusFilterChange}>
          <SelectTrigger className="w-40">
            <SelectValue />
          </SelectTrigger>
          <SelectContent>
            <SelectItem value="all">全部状态</SelectItem>
            <SelectItem value="草稿">草稿</SelectItem>
            <SelectItem value="待审核">待审核</SelectItem>
            <SelectItem value="已通过">已通过</SelectItem>
            <SelectItem value="已驳回">已驳回</SelectItem>
          </SelectContent>
        </Select>
        <Button
          variant="outline"
          onClick={onRefresh}
          disabled={loading}
        >
          <RotateCcw className="w-4 h-4 mr-2" />
          刷新
        </Button>
      </div>
    </Card>
  );
}