# Requirements Document

## Introduction

This feature adds support for Hong Kong companies in the VAT document generation system. When a company is identified as a Hong Kong company (based on the CompanyCountry field), the system should skip generating business license documents and credit report documents, as these are not required for Hong Kong companies. The Hague/Non-Hague authorization documents will still be generated, but without the business license and credit report attachments.

## Glossary

- **VAT Document Generator**: The system component responsible for generating Hague and Non-Hague authorization documents
- **Hong Kong Company**: A company where the CompanyCountry field contains "香港", "HK", or "Hong Kong" (case-insensitive)
- **Business License**: The营业执照 document and its translation
- **Credit Report**: The企业信用报告 document and its translation
- **Supporting Documents**: Business license, credit report, and ID card translation documents
- **Authorization Documents**: Hague or Non-Hague power of attorney documents

## Requirements

### Requirement 1

**User Story:** As a system administrator, I want the system to automatically detect Hong Kong companies, so that the correct document set is generated without manual intervention

#### Acceptance Criteria

1. WHEN the system processes a VAT document generation request, THE VAT Document Generator SHALL check the CompanyCountry field to determine if the company is a Hong Kong company
2. THE VAT Document Generator SHALL identify a company as a Hong Kong company IF the CompanyCountry field contains "香港", "HK", or "Hong Kong" (case-insensitive)
3. THE VAT Document Generator SHALL convert the CompanyCountry value to a standardized short code before comparison
4. THE VAT Document Generator SHALL log the Hong Kong company detection result for audit purposes

### Requirement 2

**User Story:** As a document processor, I want Hong Kong companies to skip business license generation, so that only applicable documents are produced

#### Acceptance Criteria

1. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL skip downloading the business license file
2. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL skip OCR processing of the business license
3. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL skip generating the business license translation document
4. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL exclude the business license original file from the final PDF merge
5. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL exclude the business license translation from the final PDF merge

### Requirement 3

**User Story:** As a document processor, I want Hong Kong companies to skip credit report generation, so that processing time is reduced and only necessary documents are created

#### Acceptance Criteria

1. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL skip downloading the credit report file during the synchronous phase
2. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL skip OCR processing of the credit report
3. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL skip generating the credit report translation document
4. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL exclude the credit report original file from the final PDF merge
5. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL exclude the credit report translation from the final PDF merge

### Requirement 4

**User Story:** As a document processor, I want Hong Kong companies to still generate authorization documents and ID card translations, so that the essential documents for the Hague/Non-Hague process are available

#### Acceptance Criteria

1. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL generate the Hague authorization documents (if SpecsName does not contain "免海牙")
2. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL generate the Non-Hague authorization document (if SpecsName contains "免海牙")
3. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL generate the ID card translation document
4. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL include the ID card translation in the final PDF merge
5. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL include the authorization documents in the final PDF merge

### Requirement 5

**User Story:** As a system operator, I want clear logging of Hong Kong company processing, so that I can verify the correct documents were generated

#### Acceptance Criteria

1. WHEN a Hong Kong company is detected, THE VAT Document Generator SHALL log "检测到香港公司，跳过营业执照和企业信用报告生成"
2. WHEN the business license processing is skipped, THE VAT Document Generator SHALL log "香港公司：跳过营业执照处理"
3. WHEN the credit report processing is skipped, THE VAT Document Generator SHALL log "香港公司：跳过企业信用报告处理"
4. WHEN the final PDF is merged, THE VAT Document Generator SHALL log the list of documents included for Hong Kong companies
5. THE VAT Document Generator SHALL include the Hong Kong company flag in the processing result data
