import { SetMetadata } from '@nestjs/common';

export const AUDITABLE_KEY = 'isAuditable';
export const SENSITIVE_KEY = 'isSensitive';
export const FINANCIAL_KEY = 'isFinancial';

/**
 * 标记方法需要审计
 * 使用此装饰器的方法将自动记录审计日志
 * 
 * @example
 * ```typescript
 * @Post()
 * @Auditable()
 * async createUser(@Body() dto: CreateUserDto) {
 *   return this.userService.create(dto);
 * }
 * ```
 */
export const Auditable = () => SetMetadata(AUDITABLE_KEY, true);

/**
 * 标记为敏感操作
 * 敏感操作会被特别标记和监控
 * 
 * @example
 * ```typescript
 * @Post(':id/password')
 * @Auditable()
 * @Sensitive()
 * async changePassword(@Param('id') id: string, @Body() dto: ChangePasswordDto) {
 *   return this.userService.changePassword(id, dto);
 * }
 * ```
 */
export const Sensitive = () => SetMetadata(SENSITIVE_KEY, true);

/**
 * 标记为财务相关操作
 * 财务操作需要更长的保留期限（7年）
 * 
 * @example
 * ```typescript
 * @Post('payment')
 * @Auditable()
 * @Financial()
 * async processPayment(@Body() dto: PaymentDto) {
 *   return this.paymentService.process(dto);
 * }
 * ```
 */
export const Financial = () => SetMetadata(FINANCIAL_KEY, true);

