using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TeleWave.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class WeeklyProgrammingOverrides : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "StartsAtUtc",
                table: "ProgrammingOverride",
                type: "timestamp with time zone",
                nullable: true,
                oldClrType: typeof(DateTimeOffset),
                oldType: "timestamp with time zone"
            );

            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "EndsAtUtc",
                table: "ProgrammingOverride",
                type: "timestamp with time zone",
                nullable: true,
                oldClrType: typeof(DateTimeOffset),
                oldType: "timestamp with time zone"
            );

            migrationBuilder.AddColumn<int>(
                name: "DayOfWeek",
                table: "ProgrammingOverride",
                type: "integer",
                nullable: true
            );

            migrationBuilder.AddColumn<int>(
                name: "EndMinute",
                table: "ProgrammingOverride",
                type: "integer",
                nullable: true
            );

            migrationBuilder.AddColumn<int>(
                name: "Recurrence",
                table: "ProgrammingOverride",
                type: "integer",
                nullable: false,
                defaultValue: 0
            );

            migrationBuilder.AddColumn<int>(
                name: "StartMinute",
                table: "ProgrammingOverride",
                type: "integer",
                nullable: true
            );
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(name: "DayOfWeek", table: "ProgrammingOverride");

            migrationBuilder.DropColumn(name: "EndMinute", table: "ProgrammingOverride");

            migrationBuilder.DropColumn(name: "Recurrence", table: "ProgrammingOverride");

            migrationBuilder.DropColumn(name: "StartMinute", table: "ProgrammingOverride");

            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "StartsAtUtc",
                table: "ProgrammingOverride",
                type: "timestamp with time zone",
                nullable: false,
                defaultValue: new DateTimeOffset(
                    new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                    new TimeSpan(0, 0, 0, 0, 0)
                ),
                oldClrType: typeof(DateTimeOffset),
                oldType: "timestamp with time zone",
                oldNullable: true
            );

            migrationBuilder.AlterColumn<DateTimeOffset>(
                name: "EndsAtUtc",
                table: "ProgrammingOverride",
                type: "timestamp with time zone",
                nullable: false,
                defaultValue: new DateTimeOffset(
                    new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                    new TimeSpan(0, 0, 0, 0, 0)
                ),
                oldClrType: typeof(DateTimeOffset),
                oldType: "timestamp with time zone",
                oldNullable: true
            );
        }
    }
}
