var path: String
var size: int
var total_lines: int
var source_code_lines: int
var comment_lines: int
var blank_lines: int

func _load_dir(at_path: String) -> int:
	return _load_file_info(at_path)

func _load_file_info(at_path: String, skip_line_count: bool = false) -> int:
	var file := FileAccess.open(at_path, FileAccess.READ)
	if !file:
		return FileAccess.get_open_error()
	
	path = at_path
	size = file.get_length()
	
	total_lines = 0
	source_code_lines = 0
	comment_lines = 0
	blank_lines = 0
	
	if skip_line_count:
		return OK
	
	while not file.eof_reached():
		var line: String = file.get_line()
		if _is_comment(line):
			comment_lines += 1
		elif is_blank(line):
			blank_lines += 1
		else:
			source_code_lines += 1
		total_lines +=1
	
	file.close()
	return OK

func get_name() -> String:
	return path.get_file()

func _get_extension() -> String:
	return path.get_extension()

func _get_icon() -> String:
	return ""

func _get_color() -> Color:
	return Color.TRANSPARENT

func _is_comment(line: String) -> bool:
	return false

func is_blank(line: String) -> bool:
	return line.strip_edges().is_empty()

func _is_script() -> bool:
	return false

func _is_scene() -> bool:
	return false

func _is_resource() -> bool:
	return false
