-- Create the AssaultTroop table
CREATE TABLE AssaultTroop (
    Id SERIAL PRIMARY KEY,
    ATId INT,
    Name VARCHAR(255) NOT NULL,
    Faction INT NOT NULL, -- 0 - Neutral, 1 - Allies, 2 - Axis
    Type INT NOT NULL,    -- 1 - Infantry, 4 - Armor
    Province INT NOT NULL, -- -1 - Not deployed, Province IDs
    Orders JSONB NOT NULL, -- JSON String
    Owner INT NOT NULL -- Owner ID
);

INSERT INTO AssaultTroop (Id, Name, Faction, Type, Province, Orders, Owner) VALUES
    (1, 'First Infantry Division', 2, 1, 0, '{"Dep": [], "Mov": []}', 1),
    (2, 'First Infantry Division', 1, 1, 0, '{"Dep": [], "Mov": []}', 2),
    (3, 'Second Infantry Division', 1, 1, 0, '{"Dep": [], "Mov": []}', 2),
    (4, 'Third Infantry Division', 1, 1, 0, '{"Dep": [], "Mov": []}', 2),
    (5, 'Cheeki Breeki Boys', 2, 1, 0, '{"Dep": [], "Mov": []}', 3),
    (6, 'Hitlers Men', 2, 1, 1, '{"Dep": [], "Mov": []}', 4),
    (7, 'Hitlers Men', 2, 1, 1, '{"Dep": [], "Mov": []}', 4),
    (8, 'Hitlers Men', 2, 1, 1, '{"Dep": [], "Mov": []}', 4),
    (9, 'Cheeki Breeki Boys', 2, 1, 1, '{"Dep": [], "Mov": []}', 3),
    (10, 'Hitlers Men', 2, 1, 0, '{"Dep": [], "Mov": []}', 4),
    (11, 'Fifth Infantry Division', 1, 1, -1, '{"Dep": [], "Mov": []}', 5),
    (12, 'Fifth Infantry Division', 1, 1, -1, '{"Dep": [], "Mov": []}', 5),
    (13, 'First Armor Division', 1, 4, 2, '{"Dep": [], "Mov": []}', 2),
    (14, 'Second Armor Division', 1, 4, 2, '{"Dep": [], "Mov": []}', 2),
    (15, 'Cheeki Breeki Tonks', 2, 4, 2, '{"Dep": [], "Mov": []}', 3);


-- Create the Province table
CREATE TABLE Province (
    Id SERIAL PRIMARY KEY,
    ProvinceId INT,
    Name VARCHAR(255) NOT NULL,
    Faction INT NOT NULL, -- 0 - Neutral, 1 - Allies, 2 - Axis
    Multiplier DECIMAL(3, 2) NOT NULL, -- 0-1
    ATs JSONB NOT NULL, -- JSON String
    State INT NOT NULL -- 0 - Peace, 1 - War
);

INSERT INTO Province (Id, Name, Faction, Multiplier, ATs, State) VALUES
    (0, 'Hessen', 2, 1.00, '{"Allies": [2, 3, 4], "Axis": [1, 5, 9, 10]}', 1),
    (1, 'Thuringen', 2, 1.00, '{"Allies": [], "Axis": [6, 7, 8]}', 0),
    (2, 'Rheinland-Pfalz', 1, 1.00, '{"Allies": [13, 14], "Axis": [15]}', 1),
    (4, 'Baden-Wurttemberg', 1, 1.00, '{"Allies": [17, 19], "Axis": []}', 0),
    (3, 'Saarland', 1, 1.00, '{"Allies": [16, 17, 18], "Axis": []}', 0),
    (5, 'Bayern', 1, 1.00, '{"Allies": [20, 21], "Axis": []}', 0),
    (6, 'Sachsen', 1, 1.00, '{"Allies": [23], "Axis": []}', 0),
    (7, 'Brandenburg', 2, 1.00, '{"Allies": [], "Axis": [25, 26, 27, 28]}', 0),
    (8, 'Berlin', 2, 1.00, '{"Allies": [], "Axis": [29, 30, 31]}', 0),
    (9, 'Schleswig-Holstein', 2, 1.00, '{"Allies": [], "Axis": [33]}', 0),
    (10, 'Hamburg', 2, 1.00, '{"Allies": [], "Axis": [34]}', 0),
    (11, 'Niedersachsen', 2, 1.00, '{"Allies": [], "Axis": [35]}', 0),
    (12, 'Nordreihn-Westfalen', 1, 1.00, '{"Allies": [36, 37], "Axis": []}', 0);
