using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;

using FMSAdmin.Data;
using FMSAdmin.Helpers;
using FMSAdmin.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using FMSAdmin.Models;

namespace FMSAdmin.Services {
    public class MaterialOrderStatusByRequestService {
        private readonly ILogger<MaterialOrderStatusByRequestService> _logger;
        private readonly FMSContext _context;
        private readonly StorageHelper _storage;

        public MaterialOrderStatusByRequestService(
            ILogger<MaterialOrderStatusByRequestService> logger,
            FMSContext context,
            StorageHelper storage) {
            _logger = logger;
            _context = context;
            _storage = storage;
        }

        public IQueryable<FmsMaterialPurchaseRequest> GetAll() {
            var query = _context.FmsMaterialPurchaseRequest;
            return query;
        }

        public FmsMaterialPurchaseRequest Get(int id, int siteId) {
            var data = _context.FmsMaterialPurchaseRequest.Single(x => x.PurchaseRequestId == id && x.SiteId == siteId);
            return data;
        }

        public IQueryable<FmsMaterialPurchaseRequest> Gets(int id, int siteId) {
            var data = _context.FmsMaterialPurchaseRequest.Where(x => x.PurchaseRequestId == id && x.SiteId == siteId);
            return data;
        }
    }
}