using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace CvSearch.Data.Migrations
{
    /// <inheritdoc />
    public partial class AddRequireKeywordInAnchorAndLocation : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "Location",
                schema: "cvSearch",
                table: "JobSearchTokens",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Location",
                schema: "cvSearch",
                table: "JobSearchSessions",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "RequireKeywordInAnchor",
                schema: "cvSearch",
                table: "JobProviders",
                type: "bit",
                nullable: false,
                defaultValue: true);

            // ejobs.ro (Id=1) and bestjobs.eu (Id=2) do server-side keyword filtering via their
            // search URL — the Stage 2 anchor-text filter rejects all Romanian job titles because
            // they rarely contain abstract LLM keywords.
            migrationBuilder.UpdateData(
                schema: "cvSearch",
                table: "JobProviders",
                keyColumn: "Id",
                keyValue: 1,
                column: "RequireKeywordInAnchor",
                value: false);

            migrationBuilder.UpdateData(
                schema: "cvSearch",
                table: "JobProviders",
                keyColumn: "Id",
                keyValue: 2,
                column: "RequireKeywordInAnchor",
                value: false);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Location",
                schema: "cvSearch",
                table: "JobSearchTokens");

            migrationBuilder.DropColumn(
                name: "Location",
                schema: "cvSearch",
                table: "JobSearchSessions");

            migrationBuilder.DropColumn(
                name: "RequireKeywordInAnchor",
                schema: "cvSearch",
                table: "JobProviders");
        }
    }
}
