USE [Database]

SET IDENTITY_INSERT [Tables].[product_types] ON;
INSERT INTO [Tables].[product_types]([id], [parent_id], [name])
VALUES
  (1, DEFAULT, N'Непродовольственная продукция'),
   (2, 1, N'Одежда'),
   (3, 1, N'Детские товары'),
   (4, 1, N'Декор и интерьер'),
   (5, 1, N'Хобби и творчество'),
    (6, 5, N'Настольные и карточные игры'),
     (7, 6, N'Игральные карты'),
     (8, 6, N'Аксессуары'),
   (9, 6, N'Настольные игры'),
    (10, 5, N'Пазлы и головоломки'),
   (11, 1, N'Игры и консоли'),
   (12, 1, N'Аксессуары'),
    (13, 12, N'Бижутерные украшения'),
     (14, 13, N'Брелоки и значки'),
  (15, DEFAULT, N'Продовольственная продукция'),
   (16, 15, N'Соки, воды, напитки'),
    (17, 16, N'Вода'),
   (18, 15, N'Выпечка и сладости'),
    (19, 18, N'Конфеты'),
     (20, 19, N'Драже'),
    (21, 18, N'Печенье, пряники и вафли'),
   (22, 21, N'Печенье'),
  (23, 18, N'Жевательная резинка');
SET IDENTITY_INSERT [Tables].[product_types] OFF;

SET IDENTITY_INSERT [Tables].[attributes] ON;
INSERT INTO [Tables].[attributes]([id], [name])
VALUES
  (1, 'Article number'),
  (2, 'Date of manufacture'),
  (3, 'Expiration date'),
  (4, 'Unit');
SET IDENTITY_INSERT [Tables].[attributes] OFF;

SET IDENTITY_INSERT [Tables].[products] ON;
INSERT INTO [Tables].[products] ([id], [barcode], [name], [product_type_id])
VALUES(1, 1111111111111, N'Hobby World Карточная игра Ужас Аркхэма', 9),
      (2, 2222222222222, N'Жевательная резинка Orbit Mega Клубника, без сахара, 16,4 г', 23),
	  (3, 3333333333333, N'Жевательная резинка Mentos Pure White вкус Клубника, 15,5 г', 23);
SET IDENTITY_INSERT [Tables].[products] OFF;

INSERT INTO [Tables].[product_attributes] ([product_id], [attribute_id])
VALUES (2, 2), (2, 3), (3, 2), (3, 3);

INSERT INTO [Tables].[product_values] ([product_id], [attribute_id], [value])
-- Дата изготовления; срок годности
VALUES (2, 2, N'1900-01-01'), (2, 3, N'3650'), (3, 2, N'1900-01-01'), (3, 3, N'30');

SET IDENTITY_INSERT [Tables].[suppliers] ON;
INSERT INTO [Tables].[suppliers]([id], [name], [telephone_number], [address])
VALUES
  (1, N'First supplier', N'First telephone number', N'First address'),
  (2, N'Second supplier', N'Second telephone number', N'Second address'),
  (3, N'Thied supplier', N'Third telephone number', N'Third address');
SET IDENTITY_INSERT [Tables].[suppliers] OFF;

SET IDENTITY_INSERT [Tables].[product_inflow_records] ON;
INSERT INTO [Tables].[product_inflow_records] ([id], [product_id], [barcode], [supplier_id], [count], [full_price], [datetime])
VALUES
  (1, 1, 1111111111111, 1, 5, 10, N'1900-01-01'),
  (2, 1, 1111111111111, 2, 5, 5, N'1900-01-01'),
  (3, 2, 2222222222222, 3, 5, 10, N'1900-01-01');
SET IDENTITY_INSERT [Tables].[product_inflow_records] OFF;

SET IDENTITY_INSERT [Tables].[product_outflow_records] ON;
INSERT INTO [Tables].[product_outflow_records] ([id], [product_id], [barcode], [count], [datetime])
VALUES
  (2, 1, 1111111111111, 2, N'1900-01-01'),
  (3, 1, 1111111111111, 3, N'1900-01-02')
SET IDENTITY_INSERT [Tables].[product_outflow_records] OFF;

SET IDENTITY_INSERT [Tables].[write_off_reasons] ON;
INSERT INTO [Tables].[write_off_reasons]([id], [name])
VALUES
  (1, N'Вышел срок годности'),
  (2, N'Брак продукции');
SET IDENTITY_INSERT [Tables].[write_off_reasons] OFF;

SET IDENTITY_INSERT [Tables].[product_write_off_records] ON;
INSERT INTO [Tables].[product_write_off_records] ([id], [product_id], [barcode], [reason_id], [count], [datetime])
VALUES
  (1, 1, 1111111111111, 2, 2, N'1900-01-03')
SET IDENTITY_INSERT [Tables].[product_write_off_records] OFF;