-- PetWash database initialization script

DROP DATABASE IF EXISTS petwash;

CREATE DATABASE petwash CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

USE petwash;

CREATE TABLE Packages (
    Id INT PRIMARY KEY,
    Name VARCHAR(100) NOT NULL,
    Price DECIMAL(10, 2) NOT NULL,
    DurationMinutes INT NOT NULL,
    Description VARCHAR(500),
    FirstSprayWaterTime INT NOT NULL,
    AfterShampoo1SprayTime INT NOT NULL,
    AfterShampoo2SprayTime INT NOT NULL,
    AfterShampoo3SprayTime INT NOT NULL,
    SprayShampoo1Time INT NOT NULL,
    SprayShampoo2Time INT NOT NULL,
    SprayShampoo3Time INT NOT NULL,
    HotAirTime INT NOT NULL,
    ColdAirTime INT NOT NULL,
    UvSterilizationTime INT NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE Orders (
    Id INT AUTO_INCREMENT PRIMARY KEY,
    PackageId INT NOT NULL,
    CreatedAt DATETIME NOT NULL,
    Status INT NOT NULL,
    IsPaid TINYINT(1) NOT NULL DEFAULT 0,
    PaidAt DATETIME NULL,
    StartedAt DATETIME NULL,
    CompletedAt DATETIME NULL,
    FOREIGN KEY (PackageId) REFERENCES Packages(Id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO Packages (
    Id,
    Name,
    Price,
    DurationMinutes,
    Description,
    FirstSprayWaterTime,
    AfterShampoo1SprayTime,
    AfterShampoo2SprayTime,
    AfterShampoo3SprayTime,
    SprayShampoo1Time,
    SprayShampoo2Time,
    SprayShampoo3Time,
    HotAirTime,
    ColdAirTime,
    UvSterilizationTime
) VALUES
(1, '小型犬套餐', 0.01, 20, '适用于小型犬，洗护流程较短', 2, 2, 2, 2, 1, 1, 1, 5, 2, 2),
(2, '中型犬套餐', 0.02, 26, '适用于中型犬，洗护流程适中', 3, 3, 3, 3, 1, 1, 1, 6, 3, 2),
(3, '大型犬套餐', 0.03, 37, '适用于大型犬，洗护流程更长', 4, 4, 4, 4, 2, 2, 2, 8, 4, 3);

SELECT '数据库初始化完成' AS Status;
SELECT * FROM Packages;
