// Exam2 Lab: DNA (25 pts.)
// due: Apr 12th (2026-04-162), 11:59pm
// submit your file as: username_exam2_L2.cpp
// to: james.dittrich+YSU@gmail.com

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string> 
using namespace std;

/*
What are the 4 DNA base pairs?
Attached to each sugar is one of four bases:
1. adenine (A)
2. cytosine (C)
3. guanine (G)
4. thymine (T)
The two strands are held together by hydrogen bonds between pairs of bases:
adenine pairs with thymine (A-T)
cytosine pairs with guanine (C-G)
*/

// When you have the code working, implement the following:
/**** STRUCT STUFF HERE *************************************

Struct DNA {
	string seq = "";
	string basepair = "";
	int seqLength = 0;	
};

// create new functions to work with this Struct:

DNA setSequence(DNA d, int seqLength){
	// TODO: prompt for generated sequence length.
	// TODO: reuse randomSequence() and set the struct's seq element.
	return d;
}

DNA setBasepair(DNA d){
	// TODO: reuse basepair() and set the struct's basepair element.
	return d;
}

// HINT: prints a *SINGLE* DNA struct element
void printDNA(DNA d){
	cout << "Sequence (length: " << d.seqLength << ")" << endl;
	cout << d.seq << endl;
	cout << "Matching Basepair:\n";
	cout << d.basepair << endl;
	return;
}

// in main(), declare an array or a vector:
// DNA dna[10];
// -OR-
// vector<DNA> dna;
// remember that examples of vector syntax are in the example "vector.cpp" on the website.

// iterate through the items, using the new struct functions,
// first by setting the sequence, and then setting the corresponding basepair.

// Lastly, use printDNA() to show all 10 populated elements.

***** END STRUCT SECTION *****************/ 

string basepair(string seq){
	string pairSeq = "";

	// TODO: return the complementary pair for a given valid sequence.
	// You must also handle invalid user input.
	// This should look like a loop with a nested conditional.
	// Remember that switch-case is a viable option, as it
	// can work on characters as well as integers.

	if(pairSeq.length() == seq.length()){
		return pairSeq;
	}else{
		return "ERROR: Sequence length doesn't match.\n";
	}
}


string randomSequence(unsigned len){
	string seq = "";
	char bases[] = {'A','C','G','T'};
	// TODO: assign a random base for each character of the sequence string.
	// The length of the generated sequence is specified in the len parameter.

	return seq;
}


int main(){
	string seq;
	bool done = false;
	bool valid = false;
	char response;
	int seqSize = 0;

	// TODO: Take user input and pass it basepair() defined above.
	// TODO: fix valid lowercase letters - change them to uppercase.

	cout << "\n*** RANDOM SEQUENCE GENERATOR ***\n";
	
	// TODO: prompt the user for the length of the random sequence.
	// Pass this parameter to randomSequence() above.
	// TODO: show the complementary base pair for the generated sequence.

	return 0;
}

/* EXAMPLE OUTPUT:
Please enter a valid DNA sequence (A,C,G,T): cagtactgaatgcaggc
You entered: CAGTACTGAATGCAGGC
Your DNA sequence base pair: GTCATGACTTACGTCCG
Enter another sequence? (y/n): y
Please enter a valid DNA sequence (A,C,G,T): qwertysad
You entered: QWERTYSAD
Your DNA sequence base pair: ERROR: Invalid Sequence.
Enter another sequence? (y/n): n
Goodbye!

*** RANDOM SEQUENCE GENERATOR ***
Enter the size of the sequence to be generated: 12
Your random sequence:
TCGTAGTTCGTC
Your random sequence's base pair:
AGCATCAAGCAG
Generate another random sequence? (y/n): y
Enter the size of the sequence to be generated: 24
Your random sequence:
ATCATCGGACCGACCATTGAGAAT
Your random sequence's base pair:
TAGTAGCCTGGCTGGTAACTCTTA
Generate another random sequence? (y/n): n
Goodbye!
*/
