from flasker import app, db


class Applicant(db.Model):
	firstname = db.Column(db.String(30),nullable=True)
	lastname = db.Column(db.String(30),nullable=True)
	studusername = db.Column(db.String(30),primary_key=True)
	gender = db.Column(db.String(10),nullable=True)
	dob = db.Column(db.String(30),nullable=True)
	age = db.Column(db.Integer,nullable=True)
	emailaddress = db.Column(db.String(30),nullable=True)
	parentmobno = db.Column(db.String(12),nullable=True)
	personalno = db.Column(db.String(12),nullable=True)
	alternateno = db.Column(db.String(12),nullable=True)
	nationality = db.Column(db.String(20),nullable= False)
	city = db.Column(db.String(30),nullable=True)
	state = db.Column(db.String(30),nullable=True)
	address_line1 = db.Column(db.String(100),nullable=True)
	address_line2 = db.Column(db.String(100),nullable=True)
	familyincome = db.Column(db.String(20),nullable=True)


class Student(db.Model):
	studusername = db.Column(db.String(50),(db.ForeignKey("Applicant.studusername")), nullable = True, primary_key = True)
	photo = db.Column(db.String(78),nullable= False)
	emailaddress = db.Column(db.String(30),nullable=True)
	currentaddress = db.Column(db.String(100),nullable=True)
	fathername = db.Column(db.String(100),nullable=True)
	fatherage = db.Column(db.Integer,nullable=True)
	fatherincome = db.Column(db.Integer,nullable=True)
	fatheroccupationdetails =  db.Column(db.String(100),nullable=True)
	fatheroccupationaddress =  db.Column(db.String(100),nullable=True)
	motherrname =  db.Column(db.String(50),nullable=True)
	motherage = db.Column(db.Integer,nullable=True)
	motheroccupationdetails =  db.Column(db.String(100),nullable=True)
	motherincome = db.Column(db.Integer,nullable=True)
	motheroccupationdetails =  db.Column(db.String(100),nullable=True)
	motheroccupationaddress =  db.Column(db.String(100),nullable=True)
	totalfamilymembers =  db.Column(db.Integer,nullable=True)
	educationcourse =  db.Column(db.String(100),nullable=True)
	yearorstd =  db.Column(db.String(30),nullable=True)
	institutename =  db.Column(db.String(100),nullable=True)
	collegeorschoolfees =  db.Column(db.Integer,nullable=True)
	coachingclassfees =  db.Column(db.Integer,nullable=True)
	examfees =  db.Column(db.Integer,nullable=True)
	otherfees =  db.Column(db.Integer,nullable=True)
	totalfees =  db.Column(db.Integer,nullable=True)
	helpfromgoverment = db.Column(db.String(10),nullable=True)
	owncontribution = db.Column(db.String(10),nullable=True)
	netamountrequired = db.Column(db.Integer,nullable=True)
	extracurricular = db.Column(db.String(100),nullable=True)
	reference1name = db.Column(db.String(50),nullable=True)
	reference1phoneno = db.Column(db.String(10),nullable=True)
	reference1address = db.Column(db.String(100),nullable=True)
	reference2name = db.Column(db.String(50),nullable=True)
	reference2phoneno = db.Column(db.String(10),nullable=True)
	reference2address = db.Column(db.String(100),nullable=True)
	incomecertificate = db.Column(db.String(78),nullable=True)
	uploadadharcard = db.Column(db.String(78),nullable=True)
	uploadrationcard = db.Column(db.String(78),nullable=True)
	uploadelectricitybill = db.Column(db.String(78),nullable=True)
	uploadbirthcertificate = db.Column(db.String(78),nullable=True)

class Donor(db.Model):
	fname = db.Column(db.String(30),nullable = False)
	lname = db.Column(db.String(30),nullable = False)
	donorusername = db.Column(db.String(30),primary_key=True)
	password = db.Column(db.String(20),nullable = False)
	occupation = db.Column(db.String(30),nullable = False)
	donatedamount = db.Column(db.String(20), nullable = False)
	mobileno = db.Column(db.String(12),nullable=True)

class Committeemembers(db.Model):
	fname = db.Column(db.String(30),nullable = False)
	lname = db.Column(db.String(30),nullable = False)
	role =  db.Column(db.String(30),nullable = False)
	cusername = db.Column(db.String(30),primary_key=True)
	password = db.Column(db.String(20),nullable= False)
	emailaddress = db.Column(db.String(40),nullable= False)
	mobileno = db.Column(db.String(12),nullable=True)

class Donates(db.Model):
	studusername = db.Column(db.String(30), primary_key = True)
	donorusername = db.Column(db.String(30), (db.ForeignKey("Donor.donorusername")))
	amount = db.Column(db.Integer,nullable=True)

class Volunteer(db.Model):
	fname = db.Column(db.String(30),nullable=True)
	lname = db.Column(db.String(30),nullable=True)
	vusername = db.Column(db.String(30),primary_key=True)
	password = db.Column(db.String(20),nullable=True)
	emailaddress = db.Column(db.String(40),nullable=True)
	mobileno = db.Column(db.String(12),nullable=True)

class Educon(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(30), unique=True)
    password = db.Column(db.String(30))


