HerculesCRUE_Commons-ED-MA/src/Hercules.CommonsEDMA.Desnormalizador/Models/CV/CurriculumVitaeOntology/CV.cs
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using Gnoss.ApiWrapper;
using Gnoss.ApiWrapper.Model;
using Gnoss.ApiWrapper.Helpers;
using GnossBase;
using Es.Riam.Gnoss.Web.MVC.Models;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Collections;
using Gnoss.ApiWrapper.Exceptions;
using System.Diagnostics.CodeAnalysis;
using Hercules.CommonsEDMA.Desnormalizador.Models.Actualizadores;

namespace CurriculumvitaeOntology
{
	[ExcludeFromCodeCoverage]
	public class CV : GnossOCBase
	{
        public CV() : base() { } 
		public virtual string RdfType { get { return $"{ActualizadorBase.GetUrlPrefix("roh")}CV"; } }
		public virtual string RdfsLabel { get { return $"{ActualizadorBase.GetUrlPrefix("roh")}CV"; } }
		public  object Roh_gnossUser  { get; set;} 
		public string IdRoh_gnossUser  { get; set;}
		public ProfessionalSituation Roh_professionalSituation { get; set; }
		public Qualifications Roh_qualifications { get; set; }
		public TeachingExperience Roh_teachingExperience { get; set; }
		public  ScientificExperience Roh_scientificExperience { get; set;}
		public  ScientificActivity Roh_scientificActivity { get; set;}
		public FreeTextSummary Roh_freeTextSummary { get; set; }
		public ResearchObjects Roh_researchObject { get; set; }
		public  PersonalData Roh_personalData { get; set;}
		public string IdRoh_cvOf  { get; set;} 
		public  string Foaf_name { get; set;}

		internal override void GetProperties()
		{
			propList.Add(new StringOntologyProperty("roh:cvOf", this.IdRoh_cvOf));
			propList.Add(new StringOntologyProperty("foaf:name", this.Foaf_name));
		}

		internal override void GetEntities()
		{
			Roh_personalData.GetProperties();
			Roh_personalData.GetEntities();
			OntologyEntity entityRoh_personalData = new($"{ActualizadorBase.GetUrlPrefix("roh")}PersonalData", $"{ActualizadorBase.GetUrlPrefix("roh")}PersonalData", "roh:personalData", Roh_personalData.propList, Roh_personalData.entList);
			entList.Add(entityRoh_personalData);

			Roh_professionalSituation.GetProperties();
			Roh_professionalSituation.GetEntities();
			OntologyEntity entityRoh_professionalSituation = new($"{ActualizadorBase.GetUrlPrefix("roh")}ProfessionalSituation", $"{ActualizadorBase.GetUrlPrefix("roh")}ProfessionalSituation", "roh:professionalSituation", Roh_professionalSituation.propList, Roh_professionalSituation.entList);
			entList.Add(entityRoh_professionalSituation);

			Roh_qualifications.GetProperties();
			Roh_qualifications.GetEntities();
			OntologyEntity entityRoh_qualifications = new($"{ActualizadorBase.GetUrlPrefix("roh")}Qualifications", $"{ActualizadorBase.GetUrlPrefix("roh")}Qualifications", "roh:qualifications", Roh_qualifications.propList, Roh_qualifications.entList);
			entList.Add(entityRoh_qualifications);

			Roh_teachingExperience.GetProperties();
			Roh_teachingExperience.GetEntities();
			OntologyEntity entityRoh_teachingExperience = new($"{ActualizadorBase.GetUrlPrefix("roh")}TeachingExperience", $"{ActualizadorBase.GetUrlPrefix("roh")}TeachingExperience", "roh:teachingExperience", Roh_teachingExperience.propList, Roh_teachingExperience.entList);
			entList.Add(entityRoh_teachingExperience);

			Roh_scientificExperience.GetProperties();
			Roh_scientificExperience.GetEntities();
			OntologyEntity entityRoh_scientificExperience = new ($"{ActualizadorBase.GetUrlPrefix("roh")}ScientificExperience", $"{ActualizadorBase.GetUrlPrefix("roh")}ScientificExperience", "roh:scientificExperience", Roh_scientificExperience.propList, Roh_scientificExperience.entList);
			entList.Add(entityRoh_scientificExperience);

			Roh_scientificActivity.GetProperties();
			Roh_scientificActivity.GetEntities();
			OntologyEntity entityRoh_scientificActivity = new ($"{ActualizadorBase.GetUrlPrefix("roh")}ScientificActivity", $"{ActualizadorBase.GetUrlPrefix("roh")}ScientificActivity", "roh:scientificActivity", Roh_scientificActivity.propList, Roh_scientificActivity.entList);
			entList.Add(entityRoh_scientificActivity);

			Roh_freeTextSummary.GetProperties();
			Roh_freeTextSummary.GetEntities();
			OntologyEntity entityRoh_freeTextSummary = new($"{ActualizadorBase.GetUrlPrefix("roh")}FreeTextSummary", $"{ActualizadorBase.GetUrlPrefix("roh")}FreeTextSummary", "roh:freeTextSummary", Roh_freeTextSummary.propList, Roh_freeTextSummary.entList);
			entList.Add(entityRoh_freeTextSummary);

			Roh_researchObject.GetProperties();
			Roh_researchObject.GetEntities();
			OntologyEntity entityRoh_researchObject = new($"{ActualizadorBase.GetUrlPrefix("roh")}ResearchObjects", $"{ActualizadorBase.GetUrlPrefix("roh")}ResearchObjects", "roh:researchObject", Roh_researchObject.propList, Roh_researchObject.entList);
			entList.Add(entityRoh_researchObject);
		} 

		public virtual ComplexOntologyResource ToGnossApiResource(ResourceApi resourceAPI, List<string> listaDeCategorias)
		{
			return ToGnossApiResource(resourceAPI, listaDeCategorias, Guid.Empty, Guid.Empty);
		}

		public virtual ComplexOntologyResource ToGnossApiResource(ResourceApi resourceAPI, List<string> listaDeCategorias, Guid idrecurso, Guid idarticulo)
		{
			ComplexOntologyResource resource = new();
			Ontology ontology;
			GetEntities();
			GetProperties();
			if(idrecurso.Equals(Guid.Empty) && idarticulo.Equals(Guid.Empty))
			{
				ontology = new Ontology(resourceAPI.GraphsUrl, resourceAPI.OntologyUrl, RdfType, RdfsLabel, prefList, propList, entList);
			}
			else{
				ontology = new Ontology(resourceAPI.GraphsUrl, resourceAPI.OntologyUrl, RdfType, RdfsLabel, prefList, propList, entList,idrecurso,idarticulo);
			}
			resource.Id = GNOSSID;
			resource.Ontology = ontology;
			resource.TextCategories=listaDeCategorias;
			AddResourceTitle(resource);
			AddResourceDescription(resource);
			return resource;
		}

        internal void AddResourceTitle(ComplexOntologyResource resource)
        {
            resource.Title = this.Foaf_name;
        }

        internal void AddResourceDescription(ComplexOntologyResource resource)
        {
            resource.Description = this.Foaf_name;
        }
    }
}
