I have a question about how I should design my contract to achieve the following: I want to create products identifiers (can be struct or string) something like: "product#123abc". Then I want to map a struct to it (in my case this struct holds location information) Example:
struct Location {
string city;
string street;
uint time;}
And finally I want to map multiple different location structs to my product so that I can call it like this:
function viewLocation(uint _productID, uint _location) public returns(struct){
return Product[_productID].Location[_location].city;
}
Would it also be possible to just call the productID and show me all mapped locations to it? Something like this:
function viewLocation(uint _productID) public returns(array){
return Product[_productID].Location;
}
If it doesn't work like I think about it, how would a workaround look like? I hope you can help me :)