INSERT IGNORE INTO branch
  (type, num )
VALUES
  ('NMLS', 'abc123idk'),
  ('FSRA', 'another branch');

INSERT IGNORE INTO user (
	first_name,
	last_name,
	password,
	branch_id,
	country,
	title,
	email,
	verified,
	status
) VALUES

(
	'Blue',
	'Coltrane',
	sha2('test123', 256),
	(SELECT id FROM branch LIMIT 1),
	'Canada',
	'Loan Officer',
	'test@example.com',
	true,
	'Free'
),

(
	'Giant',
	'Coltrane',
	sha2('test123', 256),
	null,
	'USA',
	'Mortgage Broker',
	'unverified@example.com',
	false,
	'Free'
),

(
	'Jeru',
	'Mulligan',
	sha2('test123', 256),
	(SELECT id FROM branch LIMIT 1),
	'USA',
	'Branch Manager',
	'manager@example.com',
	true,
	'Free'
);

INSERT IGNORE INTO license (
	user_id,
	type,
	num
) VALUES
(
	(SELECT id FROM user WHERE email = 'test@example.com' LIMIT 1),
	'NMLS',
	'randomnml523s'
),
(
	(SELECT id FROM user WHERE email = 'manager@example.com' LIMIT 1),
	'FSRA',
	'5234gsdf'
);

INSERT IGNORE INTO loan_type (
	branch_id,
	user_id,
	name
) VALUES
(
	(SELECT id FROM branch LIMIT 1),
	NULL,
	'testType'
),
(
	NULL,
	(SELECT id FROM user WHERE email="manager@example.com" LIMIT 1),
	'manager idea'
);

INSERT IGNORE INTO fee_template (
	user_id,
	branch_id,
	amount,
	perc,
	type,
	auto,
	name
) VALUES
(
	NULL,
	(SELECT id FROM branch LIMIT 1),
	0,
	200,
	'Title',
	true,
	"Lender's Title Insurance"
),
(
	(SELECT id FROM user WHERE email="manager@example.com" LIMIT 1),
	(SELECT id FROM branch LIMIT 1),
	5250,
	0,
	'Required',
	true,
	"Appraisal"
),
(
	(SELECT id FROM user WHERE email="test@example.com" LIMIT 1),
	NULL,
	9900,
	0,
	"Government",
	false,
	"Recording Charges"
),
(
	(SELECT id FROM user WHERE email="test@example.com" LIMIT 1),
	NULL,
	0,
	400,
	'Lender',
	true,
	"Processing fee"
);

INSERT IGNORE INTO loan_type (
	user_id,
	branch_id,
	name
) VALUES
(
	NULL,
	NULL,
	"Conventional"
),
(
	NULL,
	NULL,
	"FHA"
),
(
	NULL,
	NULL,
	"VA"
),
(
	NULL,
	NULL,
	"USDA"
),
(
	NULL,
	(SELECT id FROM branch LIMIT 1),
	"Test"
);

INSERT IGNORE INTO borrower (
	credit_score,
	monthly_income,
	num
) VALUES
(
	740,
	500000,
	1
);

INSERT IGNORE INTO estimate (
	user_id,
	borrower_id,
	comparison_id,
	transaction,
	loan_type_id,
	loan_amount,
	price,
	property,
	pud,
	term,
	interest,
	hoi,
	mi_name,
	mi_amount,
	lender
) VALUES
(
	(SELECT id FROM user WHERE email="test@example.com" LIMIT 1),
	(SELECT id FROM borrower ORDER BY id DESC LIMIT 1),
	NULL,
	'Purchase',
	(SELECT id FROM loan_type WHERE name="Conventional"),
	3300000,
	100000000,
	0,
	false,
	30,
	375,
	10000,
	"custom mi",
	234000,
	"For client 1"
),
(
	(SELECT id FROM user WHERE email="manager@example.com" LIMIT 1),
	(SELECT id FROM borrower ORDER BY id DESC LIMIT 1),
	NULL,
	'Purchase',
	(SELECT id FROM loan_type WHERE name="FHA"),
	2510000,
	25000000,
	0,
	false,
	30,
	300,
	10000,
	"maybe MGIC",
	234000,
	"For client 2"
),
(
	(SELECT id FROM user WHERE email="test@example.com" LIMIT 1),
	(SELECT id FROM borrower ORDER BY id DESC LIMIT 1),
	NULL,
	'Refinance',
	(SELECT id FROM loan_type WHERE name="USDA"),
	8000000,
	50000000,
	3,
	false,
	10,
	125,
	15000,
	"custom mi",
	234000,
	"Random name"
);
