"""
Data types and constants for git attribution stripping.

This module contains the shared data classes and constants used across
the git_attribution package.
"""

from dataclasses import dataclass

# Patterns for Claude attribution
CLAUDE_COAUTHOR_PATTERNS = [
    # Standard Claude co-author line
    r"Co-[Aa]uthored-[Bb]y:\s*Claude\s*<[^>]*>",
    # Anthropic domain co-authors
    r"Co-[Aa]uthored-[Bb]y:\s*[^<]*<[^>]*@anthropic\.com>",
    # Claude Code signature
    r"Co-[Aa]uthored-[Bb]y:\s*Claude\s*Code\s*<[^>]*>",
]

GENERATED_WITH_PATTERNS = [
    # Generated with Claude Code (with or without emoji)
    r"^.*Generated with \[?Claude Code\]?.*$",
    r"^.*Generated with \[?Claude\]?.*$",
]

# Backup ref namespace
# NOTE: Using refs/persuade/ instead of refs/original/ because
# git filter-branch -f cleans up refs/original/* before running
BACKUP_REF_PREFIX = "refs/persuade/backup/strip-attribution"

# Timeout constants for git operations (in seconds)
GIT_REF_OPERATION_TIMEOUT = 30  # For update-ref, rev-parse, reset operations
GIT_FILTER_BRANCH_TIMEOUT = 300  # 5 minutes for filter-branch on large histories


@dataclass
class StripResult:
    """Result of a strip attribution operation."""

    success: bool
    message: str
    commits_rewritten: int = 0
    backup_ref: str | None = None
    error: str | None = None


@dataclass
class CommitInfo:
    """Information about a commit."""

    sha: str
    message: str
    author_name: str
    author_email: str
    author_date: str
    committer_name: str
    committer_email: str
    committer_date: str
