package com.example.domain;

import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;

import com.example.service.ShoesService;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class SessionData {
	@Autowired
	ShoesService shoesService;
	private Integer shoesId;
	private String photo;
	private String shoesName;
	private Integer shoesSize;
	private Integer quantity;
	private Integer price;
	
	
	public void setSesionData(Integer shoesId, Integer quantity) {
		Shoes shoes = new Shoes();
		shoes = shoesService.findOne(shoesId);
		this.shoesId = shoesId;
		this.photo = shoes.getPhoto();
		this.shoesName = shoes.getName();
		this.shoesSize = shoes.getSize();
		this.quantity = quantity;
		this.price = shoes.getPrice() * quantity;
	}
	
	public ArrayList<SessionData> getCart(){
		ArrayList<SessionData> cartList = new ArrayList<SessionData>();
		SessionData data = new SessionData();
		data.getShoesId();
		data.getPhoto();
		data.getShoesName();
		data.getShoesSize();
		data.getQuantity();
		data.getPrice();
		cartList.add(data);
		return cartList;
		
	}
}