open-lark 0.14.0

Enterprise-grade Lark/Feishu Open API SDK with comprehensive Chinese documentation and advanced error handling
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
//! 招聘服务验证模块
//!
//! 提供招聘相关功能的验证服务,包括职位管理、人才信息、面试安排、Offer管理等。

use crate::core::validation::{ValidateBuilder, ValidationResult};
use chrono::{Datelike, NaiveDate};

/// 验证职位信息
///
/// # 参数
/// - `title`: 职位标题
/// - `description`: 职位描述
/// - `department_id`: 部门ID
/// - `recruiter_id`: 招聘负责人ID
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_job_position(
    title: &str,
    description: &str,
    department_id: &str,
    recruiter_id: &str,
) -> ValidationResult {
    // 验证职位标题
    if title.is_empty() {
        return ValidationResult::Invalid("Job title cannot be empty".to_string());
    }

    if title.len() > 100 {
        return ValidationResult::Invalid(
            "Job title too long. Maximum 100 characters allowed".to_string(),
        );
    }

    // 验证职位描述
    if description.is_empty() {
        return ValidationResult::Invalid("Job description cannot be empty".to_string());
    }

    if description.len() > 10_000 {
        return ValidationResult::Invalid(
            "Job description too long. Maximum 10,000 characters allowed".to_string(),
        );
    }

    // 验证部门ID格式
    if department_id.is_empty() {
        return ValidationResult::Invalid("Department ID cannot be empty".to_string());
    }

    if !department_id.starts_with("od_") {
        return ValidationResult::Invalid("Department ID must start with 'od_'".to_string());
    }

    // 验证招聘负责人ID
    if recruiter_id.is_empty() {
        return ValidationResult::Invalid("Recruiter ID cannot be empty".to_string());
    }

    if !recruiter_id.starts_with("ou_") {
        return ValidationResult::Invalid("Recruiter ID must start with 'ou_'".to_string());
    }

    ValidationResult::Valid
}

/// 验证工作经验要求
///
/// # 参数
/// - `min_years`: 最小工作年限
/// - `max_years`: 最大工作年限
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_work_experience(min_years: u32, max_years: Option<u32>) -> ValidationResult {
    if min_years > 50 {
        return ValidationResult::Invalid("Minimum work years cannot exceed 50".to_string());
    }

    if let Some(max) = max_years {
        if max > 50 {
            return ValidationResult::Invalid("Maximum work years cannot exceed 50".to_string());
        }

        if min_years > max {
            return ValidationResult::Invalid(
                "Minimum work years cannot be greater than maximum work years".to_string(),
            );
        }
    }

    ValidationResult::Valid
}

/// 验证薪资范围
///
/// # 参数
/// - `min_salary`: 最低薪资
/// - `max_salary`: 最高薪资
/// - `currency`: 货币类型
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_salary_range(min_salary: u32, max_salary: u32, currency: &str) -> ValidationResult {
    if min_salary == 0 {
        return ValidationResult::Invalid("Minimum salary cannot be zero".to_string());
    }

    if max_salary == 0 {
        return ValidationResult::Invalid("Maximum salary cannot be zero".to_string());
    }

    if min_salary > max_salary {
        return ValidationResult::Invalid(
            "Minimum salary cannot be greater than maximum salary".to_string(),
        );
    }

    // 验证薪资上限(1000万)
    if max_salary > 10_000_000 {
        return ValidationResult::Invalid("Maximum salary cannot exceed 10,000,000".to_string());
    }

    // 验证货币类型
    let valid_currencies = ["CNY", "USD", "EUR", "GBP", "JPY", "HKD"];
    if !valid_currencies.contains(&currency) {
        return ValidationResult::Invalid(format!(
            "Invalid currency '{}'. Valid currencies are: {}",
            currency,
            valid_currencies.join(", ")
        ));
    }

    ValidationResult::Valid
}

/// 验证人才基本信息
///
/// # 参数
/// - `name`: 姓名
/// - `email`: 邮箱
/// - `phone`: 电话号码
/// - `resume_url`: 简历URL
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_candidate_basic_info(
    name: &str,
    email: &str,
    phone: &str,
    resume_url: Option<&str>,
) -> ValidationResult {
    // 验证姓名
    if name.is_empty() {
        return ValidationResult::Invalid("Candidate name cannot be empty".to_string());
    }

    if name.len() > 50 {
        return ValidationResult::Invalid(
            "Candidate name too long. Maximum 50 characters allowed".to_string(),
        );
    }

    // 验证邮箱
    if let ValidationResult::Invalid(msg) = crate::core::validation::validate_email(email, "email")
    {
        return ValidationResult::Invalid(format!("Invalid email address: {}", msg));
    }

    // 验证电话号码
    if phone.is_empty() {
        return ValidationResult::Invalid("Phone number cannot be empty".to_string());
    }

    if !phone
        .chars()
        .all(|c| c.is_ascii_digit() || c == '+' || c == '-')
    {
        return ValidationResult::Invalid("Phone number contains invalid characters".to_string());
    }

    if phone.len() < 7 || phone.len() > 20 {
        return ValidationResult::Invalid(
            "Phone number length must be between 7 and 20 characters".to_string(),
        );
    }

    // 验证简历URL
    if let Some(url) = resume_url {
        if !url.is_empty() {
            if !url.starts_with("http://") && !url.starts_with("https://") {
                return ValidationResult::Invalid(
                    "Resume URL must start with http:// or https://".to_string(),
                );
            }

            if url.len() > 1000 {
                return ValidationResult::Invalid(
                    "Resume URL too long. Maximum 1000 characters allowed".to_string(),
                );
            }
        }
    }

    ValidationResult::Valid
}

/// 验证生日格式
///
/// # 参数
/// - `birthday`: 生日字符串(格式:YYYY-MM-DD)
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_birthday(birthday: &str) -> ValidationResult {
    if birthday.is_empty() {
        return ValidationResult::Invalid("Birthday cannot be empty".to_string());
    }

    // 解析日期
    let date = match NaiveDate::parse_from_str(birthday, "%Y-%m-%d") {
        Ok(d) => d,
        Err(_) => {
            return ValidationResult::Invalid(
                "Invalid birthday format. Expected YYYY-MM-DD".to_string(),
            );
        }
    };

    // 验证日期合理性(不能是未来日期,不能太早)
    let today = chrono::Utc::now().date_naive();
    if date > today {
        return ValidationResult::Invalid("Birthday cannot be in the future".to_string());
    }

    let min_date = NaiveDate::from_ymd_opt(1900, 1, 1).unwrap();
    if date < min_date {
        return ValidationResult::Invalid("Birthday cannot be earlier than 1900-01-01".to_string());
    }

    // 验证年龄(通常在18-70岁之间)
    let age = today.year() - date.year();
    if !(18..=70).contains(&age) {
        return ValidationResult::Invalid("Age must be between 18 and 70 years".to_string());
    }

    ValidationResult::Valid
}

/// 验证教育背景
///
/// # 参数
/// - `school`: 学校名称
/// - `degree`: 学位
/// - `major`: 专业
/// - `graduation_year`: 毕业年份
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_education_background(
    school: &str,
    degree: &str,
    major: &str,
    graduation_year: u32,
) -> ValidationResult {
    // 验证学校名称
    if school.is_empty() {
        return ValidationResult::Invalid("School name cannot be empty".to_string());
    }

    if school.len() > 100 {
        return ValidationResult::Invalid(
            "School name too long. Maximum 100 characters allowed".to_string(),
        );
    }

    // 验证学位
    let valid_degrees = ["高中", "大专", "本科", "硕士", "博士", "博士后"];
    if !valid_degrees.contains(&degree) {
        return ValidationResult::Invalid(format!(
            "Invalid degree '{}'. Valid degrees are: {}",
            degree,
            valid_degrees.join(", ")
        ));
    }

    // 验证专业
    if major.is_empty() {
        return ValidationResult::Invalid("Major cannot be empty".to_string());
    }

    if major.len() > 50 {
        return ValidationResult::Invalid(
            "Major too long. Maximum 50 characters allowed".to_string(),
        );
    }

    // 验证毕业年份
    let current_year = chrono::Utc::now().year() as u32;
    if graduation_year < 1950 || graduation_year > current_year + 5 {
        return ValidationResult::Invalid("Invalid graduation year".to_string());
    }

    ValidationResult::Valid
}

/// 验证面试安排
///
/// # 参数
/// - `interviewer_ids`: 面试官ID列表
/// - `interview_time`: 面试时间(时间戳)
/// - `duration`: 面试时长(分钟)
/// - `interview_type`: 面试类型
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_interview_arrangement(
    interviewer_ids: &[String],
    interview_time: i64,
    duration: u32,
    interview_type: &str,
) -> ValidationResult {
    // 验证面试官
    if interviewer_ids.is_empty() {
        return ValidationResult::Invalid("At least one interviewer is required".to_string());
    }

    if interviewer_ids.len() > 10 {
        return ValidationResult::Invalid("Too many interviewers. Maximum 10 allowed".to_string());
    }

    for (i, interviewer_id) in interviewer_ids.iter().enumerate() {
        if !interviewer_id.starts_with("ou_") {
            return ValidationResult::Invalid(format!(
                "Invalid interviewer ID at index {}: must start with 'ou_'",
                i
            ));
        }
    }

    // 验证面试时间
    let current_time = chrono::Utc::now().timestamp();
    if interview_time <= current_time {
        return ValidationResult::Invalid("Interview time must be in the future".to_string());
    }

    // 验证面试时间不能太远(比如1年后)
    if interview_time > current_time + 365 * 24 * 60 * 60 {
        return ValidationResult::Invalid(
            "Interview time cannot be more than 1 year in the future".to_string(),
        );
    }

    // 验证面试时长
    if !(15..=480).contains(&duration) {
        return ValidationResult::Invalid(
            "Interview duration must be between 15 and 480 minutes".to_string(),
        );
    }

    // 验证面试类型
    let valid_types = ["电话面试", "视频面试", "现场面试", "群面"];
    if !valid_types.contains(&interview_type) {
        return ValidationResult::Invalid(format!(
            "Invalid interview type '{}'. Valid types are: {}",
            interview_type,
            valid_types.join(", ")
        ));
    }

    ValidationResult::Valid
}

/// 验证Offer信息
///
/// # 参数
/// - `candidate_id`: 候选人ID
/// - `position_id`: 职位ID
/// - `salary`: 薪资
/// - `start_date`: 入职日期
/// - `expiry_date`: Offer有效期
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_offer_info(
    candidate_id: &str,
    position_id: &str,
    salary: u32,
    start_date: &str,
    expiry_date: &str,
) -> ValidationResult {
    // 验证候选人ID
    if candidate_id.is_empty() {
        return ValidationResult::Invalid("Candidate ID cannot be empty".to_string());
    }

    if !candidate_id.starts_with("oc_") {
        return ValidationResult::Invalid("Candidate ID must start with 'oc_'".to_string());
    }

    // 验证职位ID
    if position_id.is_empty() {
        return ValidationResult::Invalid("Position ID cannot be empty".to_string());
    }

    // 验证薪资
    if salary == 0 {
        return ValidationResult::Invalid("Salary cannot be zero".to_string());
    }

    if salary > 1_000_000 {
        return ValidationResult::Invalid("Salary cannot exceed 1,000,000 per month".to_string());
    }

    // 验证入职日期
    let start = match NaiveDate::parse_from_str(start_date, "%Y-%m-%d") {
        Ok(d) => d,
        Err(_) => {
            return ValidationResult::Invalid(
                "Invalid start date format. Expected YYYY-MM-DD".to_string(),
            );
        }
    };

    // 验证Offer有效期
    let expiry = match NaiveDate::parse_from_str(expiry_date, "%Y-%m-%d") {
        Ok(d) => d,
        Err(_) => {
            return ValidationResult::Invalid(
                "Invalid expiry date format. Expected YYYY-MM-DD".to_string(),
            );
        }
    };

    // 验证日期逻辑
    let today = chrono::Utc::now().date_naive();
    if start <= today {
        return ValidationResult::Invalid("Start date must be in the future".to_string());
    }

    if expiry <= today {
        return ValidationResult::Invalid("Expiry date must be in the future".to_string());
    }

    if expiry < start {
        return ValidationResult::Invalid("Expiry date must be after start date".to_string());
    }

    // 验证Offer有效期(通常不超过30天)
    let days_diff = (expiry - start).num_days();
    if days_diff > 30 {
        return ValidationResult::Invalid(
            "Offer expiry date cannot be more than 30 days after start date".to_string(),
        );
    }

    ValidationResult::Valid
}

/// 验证招聘流程状态
///
/// # 参数
/// - `current_status`: 当前状态
/// - `new_status`: 新状态
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_hiring_status_transition(
    current_status: &str,
    new_status: &str,
) -> ValidationResult {
    // 定义状态流转规则
    let valid_transitions = [
        ("简历筛选", "初试"),
        ("初试", "复试"),
        ("复试", "终试"),
        ("终试", "Offer审批"),
        ("Offer审批", "Offer已发"),
        ("Offer已发", "已接受"),
        ("Offer已发", "已拒绝"),
        ("简历筛选", "不合适"),
        ("初试", "不合适"),
        ("复试", "不合适"),
        ("终试", "不合适"),
    ];

    // 检查状态流转是否合法
    if !valid_transitions.contains(&(current_status, new_status)) {
        return ValidationResult::Invalid(format!(
            "Invalid status transition from '{}' to '{}'",
            current_status, new_status
        ));
    }

    ValidationResult::Valid
}

/// 验证招聘需求数量
///
/// # 参数
/// - `headcount`: 招聘人数
/// - `priority`: 优先级(1-5)
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_hiring_requirement(headcount: u32, priority: u8) -> ValidationResult {
    if headcount == 0 {
        return ValidationResult::Invalid("Headcount cannot be zero".to_string());
    }

    if headcount > 100 {
        return ValidationResult::Invalid("Headcount cannot exceed 100".to_string());
    }

    if !(1..=5).contains(&priority) {
        return ValidationResult::Invalid("Priority must be between 1 and 5".to_string());
    }

    ValidationResult::Valid
}

/// 验证人才库标签
///
/// # 参数
/// - `tags`: 标签列表
/// - `max_tags`: 最大标签数量
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_candidate_tags(tags: &[String], max_tags: usize) -> ValidationResult {
    if tags.len() > max_tags {
        return ValidationResult::Invalid(format!(
            "Too many tags. Maximum {} allowed, got {}",
            max_tags,
            tags.len()
        ));
    }

    for (i, tag) in tags.iter().enumerate() {
        if tag.is_empty() {
            return ValidationResult::Invalid(format!("Tag at index {} cannot be empty", i));
        }

        if tag.len() > 20 {
            return ValidationResult::Invalid(format!(
                "Tag at index {} too long. Maximum 20 characters allowed",
                i
            ));
        }

        // 验证标签字符
        if !tag
            .chars()
            .all(|c| c.is_alphanumeric() || c == '_' || c == '-' || c == ' ')
        {
            return ValidationResult::Invalid(format!(
                "Tag at index {} contains invalid characters",
                i
            ));
        }
    }

    ValidationResult::Valid
}

/// 验证面试反馈
///
/// # 参数
/// - `feedback`: 反馈内容
/// - `rating`: 评分(1-5)
/// - `interview_phase`: 面试阶段
///
/// # 返回
/// - ValidationResult: 验证结果
pub fn validate_interview_feedback(
    feedback: &str,
    rating: u8,
    interview_phase: &str,
) -> ValidationResult {
    // 验证反馈内容
    if feedback.is_empty() {
        return ValidationResult::Invalid("Feedback cannot be empty".to_string());
    }

    if feedback.len() > 2000 {
        return ValidationResult::Invalid(
            "Feedback too long. Maximum 2000 characters allowed".to_string(),
        );
    }

    // 验证评分
    if !(1..=5).contains(&rating) {
        return ValidationResult::Invalid("Rating must be between 1 and 5".to_string());
    }

    // 验证面试阶段
    let valid_phases = ["初试", "复试", "终试"];
    if !valid_phases.contains(&interview_phase) {
        return ValidationResult::Invalid(format!(
            "Invalid interview phase '{}'. Valid phases are: {}",
            interview_phase,
            valid_phases.join(", ")
        ));
    }

    ValidationResult::Valid
}

/// Builder trait for hire validation
pub trait ValidateHireBuilder {
    /// 验证职位信息
    fn validate_job_position(
        &self,
        title: &str,
        description: &str,
        department_id: &str,
        recruiter_id: &str,
    ) -> ValidationResult {
        validate_job_position(title, description, department_id, recruiter_id)
    }

    /// 验证人才基本信息
    fn validate_candidate_basic_info(
        &self,
        name: &str,
        email: &str,
        phone: &str,
        resume_url: Option<&str>,
    ) -> ValidationResult {
        validate_candidate_basic_info(name, email, phone, resume_url)
    }

    /// 验证面试安排
    fn validate_interview_arrangement(
        &self,
        interviewer_ids: &[String],
        interview_time: i64,
        duration: u32,
        interview_type: &str,
    ) -> ValidationResult {
        validate_interview_arrangement(interviewer_ids, interview_time, duration, interview_type)
    }

    /// 验证Offer信息
    fn validate_offer_info(
        &self,
        candidate_id: &str,
        position_id: &str,
        salary: u32,
        start_date: &str,
        expiry_date: &str,
    ) -> ValidationResult {
        validate_offer_info(candidate_id, position_id, salary, start_date, expiry_date)
    }
}

// 为所有实现了 ValidateBuilder 的类型自动实现 ValidateHireBuilder
impl<T: ValidateBuilder> ValidateHireBuilder for T {}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_validate_job_position() {
        // 有效职位信息
        assert!(matches!(
            validate_job_position(
                "Rust开发工程师",
                "负责Rust后端开发",
                "od_12345678",
                "ou_12345678"
            ),
            ValidationResult::Valid
        ));

        // 空标题
        assert!(matches!(
            validate_job_position("", "描述", "od_123", "ou_123"),
            ValidationResult::Invalid(_)
        ));

        // 无效部门ID
        assert!(matches!(
            validate_job_position("标题", "描述", "dept123", "ou_123"),
            ValidationResult::Invalid(_)
        ));
    }

    #[test]
    fn test_validate_work_experience() {
        // 有效工作经验
        assert!(matches!(
            validate_work_experience(3, Some(5)),
            ValidationResult::Valid
        ));

        // 最小年限超过最大
        assert!(matches!(
            validate_work_experience(5, Some(3)),
            ValidationResult::Invalid(_)
        ));

        // 年限过大
        assert!(matches!(
            validate_work_experience(60, None),
            ValidationResult::Invalid(_)
        ));
    }

    #[test]
    fn test_validate_salary_range() {
        // 有效薪资范围
        assert!(matches!(
            validate_salary_range(10000, 15000, "CNY"),
            ValidationResult::Valid
        ));

        // 最低薪资为零
        assert!(matches!(
            validate_salary_range(0, 15000, "CNY"),
            ValidationResult::Invalid(_)
        ));

        // 无效货币
        assert!(matches!(
            validate_salary_range(10000, 15000, "BTC"),
            ValidationResult::Invalid(_)
        ));
    }

    #[test]
    fn test_validate_birthday() {
        // 有效生日
        assert!(matches!(
            validate_birthday("1990-01-01"),
            ValidationResult::Valid
        ));

        // 无效格式
        assert!(matches!(
            validate_birthday("1990/01/01"),
            ValidationResult::Invalid(_)
        ));

        // 未来日期
        let future_date = (chrono::Utc::now().year() + 1).to_string() + "-01-01";
        assert!(matches!(
            validate_birthday(&future_date),
            ValidationResult::Invalid(_)
        ));
    }

    #[test]
    fn test_validate_interview_arrangement() {
        // 有效面试安排
        let interviewers = vec!["ou_12345678".to_string(), "ou_87654321".to_string()];
        let future_time = chrono::Utc::now().timestamp() + 24 * 60 * 60;
        assert!(matches!(
            validate_interview_arrangement(&interviewers, future_time, 60, "视频面试"),
            ValidationResult::Valid
        ));

        // 无面试官
        assert!(matches!(
            validate_interview_arrangement(&[], future_time, 60, "视频面试"),
            ValidationResult::Invalid(_)
        ));

        // 面试时间已过
        let past_time = chrono::Utc::now().timestamp() - 24 * 60 * 60;
        assert!(matches!(
            validate_interview_arrangement(&interviewers, past_time, 60, "视频面试"),
            ValidationResult::Invalid(_)
        ));
    }

    #[test]
    fn test_validate_offer_info() {
        // 有效Offer信息
        assert!(matches!(
            validate_offer_info(
                "oc_12345678",
                "position_123",
                20000,
                "2025-10-01",
                "2025-10-15"
            ),
            ValidationResult::Valid
        ));

        // 无效候选人ID
        assert!(matches!(
            validate_offer_info(
                "candidate123",
                "position_123",
                20000,
                "2024-02-01",
                "2024-01-15"
            ),
            ValidationResult::Invalid(_)
        ));

        // 薪资为零
        assert!(matches!(
            validate_offer_info("oc_12345678", "position_123", 0, "2024-02-01", "2024-01-15"),
            ValidationResult::Invalid(_)
        ));
    }
}