using Microsoft.AspNetCore.Razor.TagHelpers;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace OdataApplication.Models
{
    //public class OrdersDetails
    //{
    //    public OrdersDetails() { }
    //    public static List<OrdersDetails> order = new List<OrdersDetails>();
    //    public OrdersDetails(long orderid, string customerid, int employeeid, decimal freight, DateTime? orderdate, string shipcity, string id)
    //    {
    //        //this.orderid = orderid;
    //        //this.customerid = customerid;
    //        //this.employeeid = employeeid;
    //        //this.freight = freight;
    //        //this.orderdate = orderdate;
    //        //this.shipcity = shipcity;
    //        //this.id = id;
    //        this.orderid = orderid;
    //        this.customerid = customerid;
    //        this.employeeid = employeeid;
    //        this.freight = freight;
    //        this.orderdate = orderdate;
    //        this.shipcity = shipcity;
    //        this.id = id;
    //    }

    //    public static List<OrdersDetails> GetAllRecords()
    //    {
    //        if (order.Count == 0)
    //        {
    //            int code = 10000;
    //            for (int i = 0; i < 1; i++)
    //            {
    //                order.Add(new OrdersDetails(code + 1, "alfki", code + 0, 10.15m, new DateTime(1991, 05, 15), "berlin", @"""andrew""" + i));
    //                order.Add(new OrdersDetails(code + 2, "anatr", code + 2, 12.12m, new DateTime(1990, 04, 04), "madrid", @"""nancy""" + i));
    //                order.Add(new OrdersDetails(code + 3, null, code + 1, 11.9m, new DateTime(1957, 11, 30), "cholchester", @"""jarget""" + i));// anton
    //                order.Add(new OrdersDetails(code + 4, "blonp", code + 3, 9.6m, new DateTime(1930, 10, 22), "marseille", @"""margrey""" + i));
    //                order.Add(new OrdersDetails(code + 5, "bolid", code + 4, 6.3m, new DateTime(1953, 02, 18), "tsawassen", @"""doublequotes""" + i));
    //                order.Add(new OrdersDetails(code + 6, "alfki1", code + 6, 11.15m, new DateTime(1991, 05, 16), "andrew", @"""berlin""" + i));
    //                order.Add(new OrdersDetails(code + 7, "anatr1", code + 5, 13.12m, new DateTime(1990, 04, 05), "nancy", @"""madrid""" + i));
    //                order.Add(new OrdersDetails(code + 8, null, code + 9, 12.9m, new DateTime(1957, 12, 01), "jarget", @"""cholchester""" + i));// anton
    //                order.Add(new OrdersDetails(code + 9, "blonp1", code + 8, 10.6m, new DateTime(1930, 10, 23), "margrey", @"""marseille""" + i));
    //                order.Add(new OrdersDetails(code + 10, "bolid1", code + 7, 7.3m, new DateTime(1953, 02, 19), "doublequotes", @"""tsawassen""" + i));
    //                code += 10;
    //            }
    //        }
    //        return order;
    //    }

    //    [Key]
    //    public long orderid { get; set; }
    //    //[htmlattributename("customerid")]
    //    //[jsonproperty("customerid")]
    //    public string? customerid { get; set; }
    //    //[htmlattributename("employeeid")]
    //    //[jsonproperty("employeeid")]
    //    public int employeeid { get; set; }
    //    //[htmlattributename("freight")]
    //    //[jsonproperty("freight")]
    //    public decimal freight { get; set; }
    //    //[htmlattributename("orderdate")]
    //    //[jsonproperty("orderdate")]
    //    public DateTime? orderdate { get; set; }
    //    //[htmlattributename("shipcity")]
    //    //[jsonproperty("shipcity")]
    //    public string shipcity { get; set; }
    //    //[htmlattributename("id")]
    //    //[jsonproperty("id")]
    //    public string id { get; set; }


    //    //public long orderid { get; set; }
    //    //public string? customerid { get; set; }
    //    //public int employeeid { get; set; }
    //    //public decimal freight { get; set; }
    //    //public DateTime? orderdate { get; set; }
    //    //public string shipcity { get; set; }

    //    //public string id { get; set; }

    //    //[htmlattributename("orderid")]
    //    //[jsonproperty("orderid")]
    //}


    public class OrdersDetails
        {
            public OrdersDetails()
            {

            }
            public OrdersDetails(int OrderID, string CustomerId, int EmployeeId, double Freight, bool Verified, DateTime OrderDate, string ShipCity, string ShipName, string ShipCountry, DateTime ShippedDate, string ShipAddress)
            {
                this.OrderID = OrderID;
                this.CustomerID = CustomerId;
                this.EmployeeID = EmployeeId;
                this.Freight = Freight;
                this.ShipCity = ShipCity;
                this.Verified = Verified;
                this.OrderDate = OrderDate;
                this.ShipName = ShipName;
                this.ShipCountry = ShipCountry;
                this.ShippedDate = ShippedDate;
                this.ShipAddress = ShipAddress;
            }
            public static List<OrdersDetails> GetAllRecords()
            {
                List<OrdersDetails> order = new List<OrdersDetails>();
                int code = 10000;
                for (int i = 1; i < 100; i++)
                {
                    order.Add(new OrdersDetails(code + 1, "ALFKI", i + 0, 2.3 * i, false, new DateTime(1991, 05, 15, 10, 40, 00), "Berlin", "Simons bistro", "Denmark", new DateTime(1996, 7, 16), "Kirchgasse 6"));
                    order.Add(new OrdersDetails(code + 2, "ANATR", i + 2, 3.3 * i, true, new DateTime(1990, 04, 04, 09, 30, 00), "Madrid", "Queen Cozinha", "Brazil", new DateTime(1996, 9, 11), "Avda. Azteca 123"));
                    order.Add(new OrdersDetails(code + 3, "ANTON", i + 1, 4.3 * i, true, new DateTime(1957, 11, 30, 03, 45, 00), "Cholchester", "Frankenversand", "Germany", new DateTime(1996, 10, 7), "Carrera 52 con Ave. Bolívar #65-98 Llano Largo"));
                    order.Add(new OrdersDetails(code + 4, "BLONP", i + 3, 5.3 * i, false, new DateTime(1930, 10, 22, 07, 30, 00), "Marseille", "Ernst Handel", "Austria", new DateTime(1996, 12, 30), "Magazinweg 7"));
                    order.Add(new OrdersDetails(code + 5, "BOLID", i + 4, 6.3 * i, true, new DateTime(1953, 02, 18, 05, 50, 00), "Tsawassen", "Hanari Carnes", "Switzerland", new DateTime(1997, 12, 3), "1029 - 12th Ave. S."));
                    code += 5;
                }
                return order;
            }

            public static List<OrdersDetails> GetRecords()
            {
                List<OrdersDetails> orders = new List<OrdersDetails>();
                int code = 10000;
                for (int i = 1; i < 120; i++)
                {
                    orders.Add(new OrdersDetails(code + 1, "ALFKI", i + 0, 2.3 * i, false, new DateTime(1991, 05, 15, 10, 40, 00), "Berlin", "Simons bistro", "Denmark", new DateTime(1996, 7, 16, 09, 30, 00), "Kirchgasse 6"));
                    orders.Add(new OrdersDetails(code + 2, "ANATR", i + 2, 3.3 * i, true, new DateTime(1990, 04, 04, 09, 30, 00), "Madrid", "Queen Cozinha", "Brazil", new DateTime(1996, 9, 11, 03, 45, 00), "Avda. Azteca 123"));
                    orders.Add(new OrdersDetails(code + 3, "ANTON", i + 1, 4.3 * i, true, new DateTime(1957, 11, 30, 03, 45, 00), "Cholchester", "Frankenversand", "Germany", new DateTime(1996, 10, 7, 07, 50, 00), "Carrera 52 con Ave. Bolívar #65-98 Llano Largo"));
                    orders.Add(new OrdersDetails(code + 4, "BLONP", i + 3, 5.3 * i, false, new DateTime(1930, 10, 22, 07, 30, 00), "Marseille", "Ernst Handel", "Austria", new DateTime(1996, 12, 30, 06, 12, 00), "Magazinweg 7"));
                    orders.Add(new OrdersDetails(code + 5, "BOLID", i + 4, 6.3 * i, true, new DateTime(1953, 02, 18, 05, 50, 00), "Tsawassen", "Hanari Carnes", "Switzerland", new DateTime(1997, 12, 3, 12, 50, 00), "1029 - 12th Ave. S."));
                    code += 5;
                }
                return orders;
            }

            public int OrderID { get; set; }
            public string? CustomerID { get; set; }
            public int? EmployeeID { get; set; }
            public double? Freight { get; set; }
            public string? ShipCity { get; set; }
            public bool? Verified { get; set; }
            public DateTime? OrderDate { get; set; }

            public string? ShipName { get; set; }

            public string? ShipCountry { get; set; }

            public DateTime? ShippedDate { get; set; }
            public string? ShipAddress { get; set; }
        }
        //public class Orders
        //{
        //    public Orders()
        //    {

        //    }
        //    public Orders(int OrderID, string CustomerId, int EmployeeId, decimal Freight, bool Verified, DateTime OrderDate, string ShipCity, string ShipName, string ShipCountry, DateTime ShippedDate, string ShipAddress)
        //    {
        //        this.OrderID = OrderID;
        //        this.CustomerID = CustomerId;
        //        this.EmployeeID = EmployeeId;
        //        this.Freight = Freight;
        //        this.ShipCity = ShipCity;
        //        this.Verified = Verified;
        //        this.OrderDate = OrderDate;
        //        this.ShipName = ShipName;
        //        this.ShipCountry = ShipCountry;
        //        this.ShippedDate = ShippedDate;
        //        this.ShipAddress = ShipAddress;
        //    }
        //    public static List<Orders> GetAllRecords()
        //    {
        //        List<Orders> orders = new List<Orders>();
        //        int code = 10000;
        //        for (int i = 1; i < 10; i++)
        //        {
        //            orders.Add(new Orders(code + 1, "ALFKI", i + 0, 2.32m * i, false, new DateTime(1991, 05, 15), "Berlin", "Simons bistro", "Denmark", new DateTime(1996, 7, 16), "Kirchgasse 6"));
        //            orders.Add(new Orders(code + 2, "ANATR", i + 2, 3.32m * i, true, new DateTime(1990, 04, 04), "Madrid", "Queen Cozinha", "Brazil", new DateTime(1996, 9, 11), "Avda. Azteca 123"));
        //            orders.Add(new Orders(code + 3, "ANTON", i + 1, 4.35m * i, true, new DateTime(1957, 11, 30), "Cholchester", "Frankenversand", "Germany", new DateTime(1996, 10, 7), "Carrera 52 con Ave. Bolívar #65-98 Llano Largo"));
        //            orders.Add(new Orders(code + 4, "BLONP", i + 3, 5.38m * i, false, new DateTime(1930, 10, 22), "Marseille", "Ernst Handel", "Austria", new DateTime(1996, 12, 30), "Magazinweg 7"));
        //            orders.Add(new Orders(code + 5, "BOLID", i + 4, 6.35m * i, true, new DateTime(1953, 02, 18), "Tsawassen", "Hanari Carnes", "Switzerland", new DateTime(1997, 12, 3), "1029 - 12th Ave. S."));
        //            code += 5;
        //        }
        //        return orders;
        //    }

        //    public int? OrderID { get; set; }
        //    public string CustomerID { get; set; }
        //    public int? EmployeeID { get; set; }
        //    public decimal? Freight { get; set; }
        //    public string ShipCity { get; set; }
        //    public bool Verified { get; set; }
        //    public DateTime OrderDate { get; set; }

        //    public string ShipName { get; set; }

        //    public string ShipCountry { get; set; }

        //    public DateTime ShippedDate { get; set; }
        //    public string ShipAddress { get; set; }
        //}
    }