using ExtensiblePortfolioSite.SDK.Git;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace GithubPlugin
{
    [Serializable]
    public class GithubCommit : ICommit
    {
        [JsonIgnore]
        public IReadOnlyCollection<string> ModifiedFiles { get; internal set; }

        [JsonIgnore]
        public IRepository? Repository { get; internal set; }

        [JsonIgnore]
        public IGitProvider? Provider { get; internal set; }

        [JsonIgnore]
        public string? AuthorAvatarUrl { get; internal set; }

        [JsonInclude]
        [JsonPropertyName("sha")]
        public string? Hash { get; init; }

        [JsonInclude]
        [JsonPropertyName("message")]
        public string? Description { get; init; }

        public GitReference GetReference()
        {
            return new GitReference(GitReferenceKind.Commit, $"{Repository.Owner}/{Repository.Name}/{Hash}");
        }
    }
}
