/**
 * Copyright (c) 2025 SoftCorporation LLC. All rights reserved.
 *
 * The Software License, Version 1.0
 *
 * SoftCorporation LLC. grants you ("Licensee") a non-exclusive, royalty free,
 * license to use, modify and redistribute this software in source and binary
 * code form, provided that the following conditions are met:
 *
 * 1. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        SoftCorporation LLC. (http://www.softcorporation.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 2. This software and SoftCorporation name must not be used to
 *    promote products derived from the software without prior
 *    written permission. For written permission, please contact
 *    info@softcorporation.com.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * IN NO EVENT SHALL THE SOFTCORPORATION BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).
 *
 */
package com.softcorporation.sandi.index.model;

import java.io.Serializable;
import java.time.LocalDateTime;

public class IndexingJob implements Serializable {

    private static final long serialVersionUID = 5741129333358063183L;

	public enum JobStatus {
        SCHEDULED, RUNNING, COMPLETED, FAILED, CANCELLED
    }

    private String jobId;
    private String clientId;
    private String jobType;
    private String cron;
    private String location;
    private String fileExtensions;
    private boolean forceReindexing;
    private LocalDateTime scheduledTime;
    private LocalDateTime createdTime;
    private LocalDateTime startedTime;
    private LocalDateTime completedTime;
    private JobStatus status;
    private String message;
    private int totalFiles;
    private int totalDocuments;
    private int successfulDocuments;
    private int failedDocuments;

    public IndexingJob() {
        this.createdTime = LocalDateTime.now();
        this.status = JobStatus.SCHEDULED;
    }

    public IndexingJob(String jobId, String clientId, String jobType,  String cron, String location, 
    		String fileExtensions, Boolean forceReindexing, LocalDateTime scheduledTime, LocalDateTime createdTime) {
        this.jobId = jobId;
        this.clientId = clientId;
        this.jobType = jobType;
        this.location = location;
        this.fileExtensions = fileExtensions;
        this.forceReindexing = forceReindexing;
        this.scheduledTime = scheduledTime;
        this.createdTime = createdTime;
    }

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getJobType() {
        return jobType;
    }

    public void setJobType(String jobType) {
        this.jobType = jobType;
    }

    public String getCron() {
        return cron;
    }

    public void setCron(String cron) {
        this.cron = cron;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public Boolean getForceReindexing() {
        return forceReindexing;
    }

    public void setForceReindexing(Boolean forceReindexing) {
        this.forceReindexing = forceReindexing;
    }
    
    public String getFileExtensions() {
        return fileExtensions;
    }

    public void setFileExtensions(String fileExtensions) {
        this.fileExtensions = fileExtensions;
    }
    
    public LocalDateTime getScheduledTime() {
        return scheduledTime;
    }

    public void setScheduledTime(LocalDateTime scheduledTime) {
        this.scheduledTime = scheduledTime;
    }

    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }

    public LocalDateTime getStartedTime() {
        return startedTime;
    }

    public void setStartedTime(LocalDateTime startedTime) {
        this.startedTime = startedTime;
    }

    public LocalDateTime getCompletedTime() {
        return completedTime;
    }

    public void setCompletedTime(LocalDateTime completedTime) {
        this.completedTime = completedTime;
    }

    public JobStatus getStatus() {
        return status;
    }

    public void setStatus(JobStatus status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getTotalFiles() {
        return totalFiles;
    }

    public void setTotalFiles(int totalFiles) {
        this.totalFiles = totalFiles;
    }

    public int getTotalDocuments() {
        return totalDocuments;
    }

    public void setTotalDocuments(int totalDocuments) {
        this.totalDocuments = totalDocuments;
    }

    public int getSuccessfulDocuments() {
        return successfulDocuments;
    }

    public void setSuccessfulDocuments(int successfulDocuments) {
        this.successfulDocuments = successfulDocuments;
    }

    public int getFailedDocuments() {
        return failedDocuments;
    }

    public void setFailedDocuments(int failedDocuments) {
        this.failedDocuments = failedDocuments;
    }

    @Override
    public String toString() {
        return "IndexingJob{" +
                "jobId='" + jobId + '\'' +
                ", clientId='" + clientId + '\'' +
                ", jobType='" + jobType + '\'' +
                ", cron='" + cron + '\'' +
                ", location='" + location + '\'' +
                ", fileExtensions='" + fileExtensions + '\'' +
                ", forceReindexing='" + forceReindexing + '\'' +
                ", scheduledTime=" + scheduledTime +
                ", status=" + status +
                ", totalFiles=" + totalFiles +
                ", totalDocuments=" + totalDocuments +
                ", successfulDocuments=" + successfulDocuments +
                ", failedDocuments=" + failedDocuments +
                '}';
    }
}