-- Migration: Seed data for all tables
-- This file inserts 5 sample entries for each table

-- Clean and reset auto increments for _brand_specs tables
TRUNCATE TABLE shock_brand_specs RESTART IDENTITY CASCADE;
TRUNCATE TABLE brake_brand_specs RESTART IDENTITY CASCADE;
TRUNCATE TABLE leg_brand_specs RESTART IDENTITY CASCADE;
TRUNCATE TABLE strut_brand_specs RESTART IDENTITY CASCADE;
TRUNCATE TABLE disk_brand_specs RESTART IDENTITY CASCADE;

-- Insert vehicle brands (5 entries)
INSERT INTO vehicle_brands (brand) VALUES
  ('Toyota'),
  ('Honda'),
  ('Ford'),
  ('Chevrolet'),
  ('BMW')
ON CONFLICT (brand) DO NOTHING;

-- Insert vehicle types (5 entries)
INSERT INTO vehicle_type (type) VALUES
  ('Sedan'),
  ('SUV'),
  ('Truck'),
  ('Coupe'),
  ('Hatchback')
ON CONFLICT DO NOTHING;

-- Insert vehicle model years (5 entries)
INSERT INTO vehicle_model_year (model, "fk_idVehicleBrand", "fk_idVehicleType") VALUES
  ('Camry', 1, 1),
  ('Civic', 2, 1),
  ('F-150', 3, 3),
  ('Silverado', 4, 3),
  ('X5', 5, 2)
ON CONFLICT DO NOTHING;

-- Insert shock brand specs (5 entries)
INSERT INTO shock_brand_specs (
  "partNumber", "product", "serie", "quantity", "tier", "position",
  "accesories", "extendedLong", "compressedLong", "extension",
  "superiorMount", "inferiorMount", "imageProduct", "vehicleAttrs",
  "notes", "technicalSheet", "fk_idVehicleModelYear", "years", "yearsRange"
) VALUES
  ('SNY-001', 'Shock Absorber Premium', 'Series A', 1, 'Tier 1', 'Front',
   'Mounting Kit', 500, 350, 150, 'Standard', 'Standard', '/img/shock1.png', 'Front Wheel',
   'High performance', '/docs/shock1.pdf', 1, '2020', NULL),
  ('SNY-002', 'Shock Absorber Standard', 'Series B', 1, 'Tier 2', 'Rear',
   'Bumper', 480, 340, 140, 'Standard', 'Standard', '/img/shock2.png', 'Rear Wheel',
   'Standard replacement', '/docs/shock2.pdf', 2, '2021', NULL),
  ('SNY-003', 'Shock Absorber Heavy Duty', 'Series C', 1, 'Tier 3', 'Front',
   'Mounting Kit', 520, 360, 160, 'Heavy Duty', 'Heavy Duty', '/img/shock3.png', 'Front Wheel',
   'For heavy loads', '/docs/shock3.pdf', 3, NULL, '2020,2025'),
  ('SNY-004', 'Shock Absorber Sport', 'Series S', 1, 'Tier 1', 'Front',
   'Complete Kit', 510, 355, 155, 'Sport', 'Sport', '/img/shock4.png', 'Front Wheel',
   'Sport handling', '/docs/shock4.pdf', 4, '2022', NULL),
  ('SNY-005', 'Shock Absorber Economy', 'Series E', 1, 'Tier 3', 'Rear',
   'None', 470, 330, 140, 'Standard', 'Standard', '/img/shock5.png', 'Rear Wheel',
   'Budget option', '/docs/shock5.pdf', 5, NULL, '2019,2024')
ON CONFLICT DO NOTHING;

-- Insert brake brand specs (5 entries)
INSERT INTO brake_brand_specs (
  "partNumber", "product", "serie", "tier", "quantity", "position",
  "fmsi", "includesHardware", "imageProduct", "vehicleAttrs",
  "imageProductDimentions", "technicalSheet", "fk_idVehicleModelYear",
  "fk_idBrakeBrand", "years", "yearsRange"
) VALUES
  ('BRK-001', 'Brake Pad Set', 'Premium', 'Tier 1', 1, 'Front',
   'D1234', 'Yes', '/img/brake1.png', 'Front Wheel',
   '200x100x20', '/docs/brake1.pdf', 1, 1, '2020', NULL),
  ('BRK-002', 'Brake Pad Set', 'Standard', 'Tier 2', 1, 'Rear',
   'D5678', 'Yes', '/img/brake2.png', 'Rear Wheel',
   '180x90x18', '/docs/brake2.pdf', 2, 1, '2021', NULL),
  ('BRK-003', 'Brake Pad Set', 'Heavy Duty', 'Tier 1', 1, 'Front',
   'D9012', 'Yes', '/img/brake3.png', 'Front Wheel',
   '220x110x22', '/docs/brake3.pdf', 3, 1, NULL, '2020,2025'),
  ('BRK-004', 'Brake Pad Set', 'Sport', 'Tier 1', 1, 'Front',
   'D3456', 'Yes', '/img/brake4.png', 'Front Wheel',
   '210x105x21', '/docs/brake4.pdf', 4, 1, '2022', NULL),
  ('BRK-005', 'Brake Pad Set', 'Economy', 'Tier 3', 1, 'Rear',
   'D7890', 'No', '/img/brake5.png', 'Rear Wheel',
   '170x85x17', '/docs/brake5.pdf', 5, 1, NULL, '2019,2024')
ON CONFLICT DO NOTHING;

-- Insert extra type product caracteristics (5 entries)
INSERT INTO extra_type_product_caracteristics (category) VALUES
  ('Filters'),
  ('Oils'),
  ('Spark Plugs'),
  ('Belts'),
  ('Hoses')
ON CONFLICT DO NOTHING;

-- Insert extra type brands (5 entries)
INSERT INTO extra_type_brand ("brand", "image", "id_fkProductCategory") VALUES
  ('Bosch', '/img/brand/bosch.png', 1),
  ('Castrol', '/img/brand/castrol.png', 2),
  ('NGK', '/img/brand/ngk.png', 3),
  ('Gates', '/img/brand/gates.png', 4),
  ('Dayco', '/img/brand/dayco.png', 5)
ON CONFLICT DO NOTHING;

-- Insert extra type products (5 entries)
INSERT INTO extra_type_product ("type", "notes", "name", "id_fktypeBrand") VALUES
  ('Oil Filter', 'Standard oil filter', 'Premium Oil Filter', 1),
  ('Synthetic Oil', 'Full synthetic 5W-30', 'Synthetic Motor Oil', 2),
  ('Iridium Spark Plug', 'Long life spark plug', 'Iridium Spark Plug', 3),
  ('Timing Belt', 'High durability belt', 'Timing Belt Kit', 4),
  ('Radiator Hose', 'OEM replacement', 'Radiator Hose', 5)
ON CONFLICT DO NOTHING;

-- Insert extra product stocks (5 entries)
INSERT INTO extra_product_stocks (quantity, "fk_idExtraProduct") VALUES
  (50, 1),
  (100, 2),
  (200, 3),
  (30, 4),
  (25, 5)
ON CONFLICT DO NOTHING;

-- Insert shock stocks (5 entries)
INSERT INTO shock_stocks (quantity, "fk_idShock") VALUES
  (10, 1),
  (15, 2),
  (8, 3),
  (12, 4),
  (20, 5)
ON CONFLICT DO NOTHING;

-- Insert brake stocks (5 entries)
INSERT INTO brake_stocks (quantity, "fk_idBrake") VALUES
  (25, 1),
  (30, 2),
  (18, 3),
  (22, 4),
  (35, 5)
ON CONFLICT DO NOTHING;

-- Insert users (5 entries)
INSERT INTO users (email, password) VALUES
  ('admin@mipdsa.com', '$2a$10$abcdefghijklmnopqrstuv'),
  ('user1@example.com', '$2a$10$zyxwvutsrqponmlkjihgf'),
  ('user2@example.com', '$2a$10$1234567890abcdefghij'),
  ('user3@example.com', '$2a$10$abcdefghij1234567890'),
  ('user4@example.com', '$2a$10$xyz1234567890abcde')
ON CONFLICT (email) DO NOTHING;