using System;
using System.Threading.Tasks;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DataModel;
using Amazon.Runtime;
using ConsoleTables.Core;

namespace dynamodb_local_sample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var creds = new BasicAWSCredentials("fakeMyAccessKeyId", "fakeSecretAccessKe");
            var config = new AmazonDynamoDBConfig()
            {
                ServiceURL = "http://localhost:8002",
                AuthenticationRegion = "ap-southeast-2",
            };
            var client = new AmazonDynamoDBClient(creds, config);
            var context = new DynamoDBContext(client);
            var newData = new WeatherForecast() {City = "Brisbane", Date = DateTime.Now.ToString()};
            // await context.SaveAsync(newData);
            var data = await context.ScanAsync<WeatherForecast>(null).GetRemainingAsync();
            ConsoleTable.From(data).Write();

            Console.Read();
        }
    }

    public class WeatherForecast
    {
        public string City { get; set; }
        public string Date { get; set; }
    }
}