package org.sagebionetworks.repo.manager.drs;

import org.sagebionetworks.StackConfiguration;
import org.sagebionetworks.repo.model.drs.PackageInformation;
import org.sagebionetworks.repo.model.drs.OrganizationInformation;
import org.sagebionetworks.repo.model.drs.ServiceInformation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class DRSManagerImpl implements DRSManager {
    public static final String REVERSE_DOMAIN_NOTATION = "org.sagebase.prod.repo-prod";
    public static final String SERVICE_NAME = "Sage Bionetworks Synapse DRS API";
    public static final String CONTACT_URL = "https://sagebionetworks.jira.com/servicedesk/customer/portal/9";
    public static final String DOCUMENTATION_URL = "https://docs.synapse.org";
    public static final String DRS_URL = "https://repo-prod.prod.sagebase.org";
    public static final String DRS_GROUP = "org.ga4gh";
    public static final String DRS_ARTIFACT = "drs";
    public static final String DRS_VERSION = "1.2.0";
    public static final String ORGANIZATION_NAME = "Sage Bionetworks";
    public static final String ORGANIZATION_URL = "https://www.sagebionetworks.org";
    public static final String DESCRIPTION = "This service provides implementation of DRS specification for " +
            "accessing FileEntities and Datasets within Synapse.";
    public static Date CREATED_AT = new Date("Tue Jul 29 12:27:16 PDT 2022");
    public static Date UPDATED_AT = new Date("Tue Jul 29 12:27:16 PDT 2022");

    private StackConfiguration stackConfiguration;

    @Autowired
    public DRSManagerImpl(StackConfiguration stackConfiguration) {
        super();
        this.stackConfiguration = stackConfiguration;
    }

    @Override
    public ServiceInformation getServiceInformation() {
        ServiceInformation result = new ServiceInformation();
        result.setId(REVERSE_DOMAIN_NOTATION);
        result.setName(SERVICE_NAME);
        PackageInformation drsPackageInformation = new PackageInformation();
        drsPackageInformation.setGroup(DRS_GROUP);
        drsPackageInformation.setArtifact(DRS_ARTIFACT);
        drsPackageInformation.setVersion(DRS_VERSION);
        result.setType(drsPackageInformation);
        result.setDescription(DESCRIPTION);
        OrganizationInformation organization = new OrganizationInformation();
        organization.setName(ORGANIZATION_NAME);
        organization.setUrl(ORGANIZATION_URL);
        result.setOrganization(organization);
        result.setContactUrl(CONTACT_URL);
        result.setDocumentationUrl(DOCUMENTATION_URL);
        result.setCreatedAt(CREATED_AT);
        result.setUpdatedAt(UPDATED_AT);
        result.setEnvironment(stackConfiguration.getStack());
        result.setVersion(stackConfiguration.getStackInstance());
        result.setUrl(DRS_URL);
        return result;
    }
}

@@ -129,23 +129,28 @@
 del.drs.
-Package
+Organization
 Informat
@@ -192,36 +192,31 @@
 o.model.drs.
-Organization
+Package
 Information;
@@ -389,16 +389,73 @@
 rvice;%0A%0A
+import java.time.LocalDate;%0Aimport java.time.ZoneOffset;%0A
 import j
@@ -1469,16 +1469,90 @@
 apse.%22;%0A
+    private static final LocalDate localDate = LocalDate.of(2022, 8, 01);%0A
     publ
@@ -1557,24 +1557,30 @@
 blic static 
+final 
 Date CREATED
@@ -1589,47 +1589,68 @@
 T = 
-new Date(%22Tue Jul 29 12:27:16 PDT 2022%22
+Date.from(localDate.atStartOfDay(ZoneOffset.UTC).toInstant()
 );%0A 
@@ -1666,16 +1666,22 @@
  static 
+final 
 Date UPD
@@ -1694,47 +1694,68 @@
 T = 
-new Date(%22Tue Jul 29 12:27:16 PDT 2022%22
+Date.from(localDate.atStartOfDay(ZoneOffset.UTC).toInstant()
 );%0A%0A

convert String to LocalDate UTC