#include <stdio.h> // Include stdio.h for basic functions
#include <string.h> // Include string.h for string manipulation

#include "Artist.h" // Include Artist.h for related structs and function prototypes
#include "Artwork.h" // Include Artwork.h for related structs and function prototypes

Artwork InitArtwork() { // Function to initialize variables in Artwork struct to default, used only in unit tests
    Artwork artwork; // Create local artwork struct variable
    strcpy(artwork.title, "None"); // Copy "None" to name in artwork struct
    artwork.yearCreated = 0; // Set yearCreated in artwork struct to 0
    InitArtist(); // Call InitArtist()
    return artwork; // Return artwork struct variable
}

Artwork SetArtwork(char* title, int yearCreated, Artist artist) { // Function to set variables in artwork struct to user input
    Artwork artwork; // Create local artwork struct variable
    artwork.artist = artist; // Set artist struct variable in artwork struct variable to artist struct variable (please don't ask me to explain this one)
    strcpy(artwork.title, title); // Copy user input title to title in artwork struct
    artwork.yearCreated = yearCreated; // Set yearCreated in artwork struct to user input yearCreated
    return artwork; // Return artwork struct variable
}

void GetTitle(char* title, Artwork artwork) { // Function to return title of artwork, used only in unit tests
    strcpy(title, artwork.title); // Copy user input title to title in artwork struct
}

int GetYearCreated(Artwork artwork) { // Function to return yearCreated of artwork, used only in unit tests
    return artwork.yearCreated; // Return yearCreated in artwork struct
}

Artist GetArtist(Artwork artwork) { // Function to return artist information from artwork struct
    return artwork.artist; // Return artist in artwork struct
}

void PrintArtwork(Artwork artwork) { // Function to print artwork information
    PrintArtist(artwork.artist); // Call PrintArtist(), because main.c is missing this call for some reason
    printf("Title: %s, %d\n", artwork.title, artwork.yearCreated); // Print artwork information
}