using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace CvSearch.Data.Migrations
{
    /// <inheritdoc />
    public partial class AddLocationToProviders : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            // ejobs.ro (Id=1): location in URL path as slug, keywords via q= param.
            // Verified URL structure: /locuri-de-munca/{location-slug}?q={keywords}
            migrationBuilder.UpdateData(
                schema: MigrationConstants.SchemaName,
                table: "JobProviders",
                keyColumn: "Id",
                keyValue: 1,
                column: "SearchUrlTemplate",
                value: "https://www.ejobs.ro/locuri-de-munca/{location-slug}?q={keywords}");

            // bestjobs.eu (Id=2): location in URL path as slug, keywords via query param.
            // Verified URL structure: /ro/locuri-de-munca-in-{location-slug}?keywords={keywords}
            migrationBuilder.UpdateData(
                schema: MigrationConstants.SchemaName,
                table: "JobProviders",
                keyColumn: "Id",
                keyValue: 2,
                column: "SearchUrlTemplate",
                value: "https://bestjobs.eu/ro/locuri-de-munca-in-{location-slug}?keywords={keywords}");

            // linkedin.com (Id=3): location as query parameter.
            migrationBuilder.UpdateData(
                schema: MigrationConstants.SchemaName,
                table: "JobProviders",
                keyColumn: "Id",
                keyValue: 3,
                column: "SearchUrlTemplate",
                value: "https://www.linkedin.com/jobs/search/?keywords={keywords}&location={location}");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.UpdateData(
                schema: MigrationConstants.SchemaName,
                table: "JobProviders",
                keyColumn: "Id",
                keyValue: 1,
                column: "SearchUrlTemplate",
                value: "https://www.ejobs.ro/locuri-de-munca?q={keywords}");

            migrationBuilder.UpdateData(
                schema: MigrationConstants.SchemaName,
                table: "JobProviders",
                keyColumn: "Id",
                keyValue: 2,
                column: "SearchUrlTemplate",
                value: "https://www.bestjobs.eu/ro/locuri-de-munca?keywords={keywords}");

            migrationBuilder.UpdateData(
                schema: MigrationConstants.SchemaName,
                table: "JobProviders",
                keyColumn: "Id",
                keyValue: 3,
                column: "SearchUrlTemplate",
                value: "https://www.linkedin.com/jobs/search/?keywords={keywords}");
        }
    }
}
