'use client';

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

interface MessageTemplateSearchProps {
  searchKeyword: string;
  onSearchChange: (value: string) => void;
  typeFilter: string;
  onTypeFilterChange: (value: string) => void;
}

export function MessageTemplateSearch({
  searchKeyword,
  onSearchChange,
  typeFilter,
  onTypeFilterChange
}: MessageTemplateSearchProps) {
  return (
    <Card className="p-4">
      <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
        <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>
        <Select value={typeFilter} onValueChange={onTypeFilterChange}>
          <SelectTrigger>
            <SelectValue placeholder="消息类型" />
          </SelectTrigger>
          <SelectContent>
            <SelectItem value="all">全部类型</SelectItem>
            <SelectItem value="sms">短信</SelectItem>
            <SelectItem value="email">邮件</SelectItem>
            <SelectItem value="internal">站内信</SelectItem>
            <SelectItem value="push">推送</SelectItem>
          </SelectContent>
        </Select>
      </div>
    </Card>
  );
}