from flask import Flask,jsonify,request
import csv
all_movies=[]
with open('movies.csv',encoding='utf-8')as f:
    reader=csv.reader(f)
    data=list(reader)
    all_movies=data[1:]
liked_movies=[]
Unliked_movies=[]
did_not_watch=[]
app=Flask(__name__)
@app.route('/get-movie')
def get_movie():
    return jsonify({
        'data':all_movies[0],
        'status':'success'
    }),201

@app.route('/liked-movies',methods=['POST'])
def liked_movies():
     global all_movies
     movie=all_movies[0]
     all_movies=all_movies[1:]
     liked_movies.append(movie)
     return jsonify({
         'status':'success'
     }),201
@app.route('/Unliked-movies',methods=['POST'])
def Unliked_movies():
     global all_movies
     movie=all_movies[0]
     all_movies=all_movies[1:]
     Unliked_movies.append(movie)
     return jsonify({
         'status':'success'
     }),201
@app.route('/did-not-watch',methods=['POST'])
def did_not__watch_movies():
     global all_movies
     movie=all_movies[0]
     all_movies=all_movies[1:]
     did_not_watch.append(movie)
     return jsonify({
         'status':'success'
     }),201
if __name__ =='__main__':
    app.run()