# Generated by Django 5.2 on 2025-09-17

import uuid

from django.db import migrations, models


def seed_tool_friendly_names(apps, schema_editor):
    ToolFriendlyName = apps.get_model('api', 'ToolFriendlyName')

    defaults = {
        'mcp_brightdata_search_engine': 'Bright Data Search',
        'mcp_brightdata_scrape_as_markdown': 'Bright Data Web Snapshot',
        'google_sheets-add-single-row': 'Google Sheets - Add Row',
        'google_drive-create-doc': 'Google Drive - Create Doc',
        'google_docs-append-text': 'Google Docs - Append Text',
        'slack-post-message': 'Slack - Post Message',
        'slack-fetch-channel-history': 'Slack - Channel History',
        'jira-search-issues': 'Jira - Search Issues',
        'pagerduty-fetch-incident': 'PagerDuty - Fetch Incident',
        'google_calendar-create-event': 'Google Calendar - Create Event',
        'salesforce-update-record': 'Salesforce - Update Record',
        'zendesk-create-comment': 'Zendesk - Create Comment',
        'greenhouse-create-candidate': 'Greenhouse - Create Candidate',
        'mcp_test_tool': 'Test MCP Tool',
    }

    for tool_name, display_name in defaults.items():
        ToolFriendlyName.objects.get_or_create(
            tool_name=tool_name,
            defaults={'display_name': display_name},
        )


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0131_seed_ai_employee_templates'),
        ('api', '0130_persistentagent_sent_expiration_email'),
    ]

    operations = [
        migrations.CreateModel(
            name='ToolFriendlyName',
            fields=[
                ('id', models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)),
                ('tool_name', models.CharField(help_text="Internal tool identifier (e.g., 'google_sheets-add-single-row').", max_length=128, unique=True)),
                ('display_name', models.CharField(help_text='User-facing label shown in the directory UI.', max_length=255)),
                ('description', models.TextField(blank=True, help_text='Optional notes to help admins remember what the tool does.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['tool_name'],
            },
        ),
        migrations.RunPython(seed_tool_friendly_names, migrations.RunPython.noop),
    ]
