/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 * 
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
// TODO: Include PageTemplateModels here too?? Probably
 */


/**
 * @class
 * Initializes a new instance of the JobStatisticsVertexStage class.
 * @constructor
 * The Data Lake Analytics job statistics vertex stage information.
 *
 * @member {number} [dataRead] the amount of data read, in bytes.
 * 
 * @member {number} [dataReadCrossPod] the amount of data read across multiple
 * pods, in bytes.
 * 
 * @member {number} [dataReadIntraPod] the amount of data read in one pod, in
 * bytes.
 * 
 * @member {number} [dataToRead] the amount of data remaining to be read, in
 * bytes.
 * 
 * @member {number} [dataWritten] the amount of data written, in bytes.
 * 
 * @member {number} [duplicateDiscardCount] the number of duplicates that were
 * discarded.
 * 
 * @member {number} [failedCount] the number of failures that occured in this
 * stage.
 * 
 * @member {number} [maxVertexDataRead] the maximum amount of data read in a
 * single vertex, in bytes.
 * 
 * @member {number} [minVertexDataRead] the minimum amount of data read in a
 * single vertex, in bytes.
 * 
 * @member {number} [readFailureCount] the number of read failures in this
 * stage.
 * 
 * @member {number} [revocationCount] the number of vertices that were revoked
 * during this stage.
 * 
 * @member {number} [runningCount] the number of currently running vertices in
 * this stage.
 * 
 * @member {number} [scheduledCount] the number of currently scheduled
 * vertices in this stage
 * 
 * @member {string} [stageName] the name of this stage in job execution.
 * 
 * @member {number} [succeededCount] the number of vertices that succeeded in
 * this stage.
 * 
 * @member {number} [tempDataWritten] the amount of temporary data written, in
 * bytes.
 * 
 * @member {number} [totalCount] the total vertex count for this stage.
 * 
 * @member {moment.duration} [totalFailedTime] the amount of time that failed
 * vertices took up in this stage.
 * 
 * @member {number} [totalProgress] the current progress of this stage, as a
 * percentage.
 * 
 * @member {moment.duration} [totalSucceededTime] the amount of time all
 * successful vertices took in this stage.
 * 
 */
export interface JobStatisticsVertexStage {
    dataRead?: number;
    dataReadCrossPod?: number;
    dataReadIntraPod?: number;
    dataToRead?: number;
    dataWritten?: number;
    duplicateDiscardCount?: number;
    failedCount?: number;
    maxVertexDataRead?: number;
    minVertexDataRead?: number;
    readFailureCount?: number;
    revocationCount?: number;
    runningCount?: number;
    scheduledCount?: number;
    stageName?: string;
    succeededCount?: number;
    tempDataWritten?: number;
    totalCount?: number;
    totalFailedTime?: moment.Duration;
    totalProgress?: number;
    totalSucceededTime?: moment.Duration;
}

/**
 * @class
 * Initializes a new instance of the JobStatistics class.
 * @constructor
 * The Data Lake Analytics job execution statistics.
 *
 * @member {date} [lastUpdateTimeUtc] the last update time for the statistics.
 * 
 * @member {array} [stages] the list of stages for the job.
 * 
 */
export interface JobStatistics {
    lastUpdateTimeUtc?: Date;
    stages?: JobStatisticsVertexStage[];
}

/**
 * @class
 * Initializes a new instance of the JobDataPath class.
 * @constructor
 * A Data Lake Analytics job data path item.
 *
 * @member {uuid} [jobId] the id of the job this data is for.
 * 
 * @member {string} [command] the command that this job data relates to.
 * 
 * @member {array} [paths] the list of paths to all of the job data.
 * 
 */
export interface JobDataPath {
    jobId?: string;
    command?: string;
    paths?: string[];
}

/**
 * @class
 * Initializes a new instance of the JobStateAuditRecord class.
 * @constructor
 * The Data Lake Analytics job state audit records for tracking the lifecycle
 * of a job.
 *
 * @member {string} [newState] the new state the job is in.
 * 
 * @member {date} [timeStamp] the time stamp that the state change took place.
 * 
 * @member {string} [requestedByUser] the user who requests the change.
 * 
 * @member {string} [details]  the details of the audit log.
 * 
 */
export interface JobStateAuditRecord {
    newState?: string;
    timeStamp?: Date;
    requestedByUser?: string;
    details?: string;
}

/**
 * @class
 * Initializes a new instance of the JobResource class.
 * @constructor
 * The Data Lake Analytics job resources.
 *
 * @member {string} [name] the name of the resource.
 * 
 * @member {string} [resourcePath] the path to the resource.
 * 
 * @member {string} [type] the job resource type. Possible values include:
 * 'VertexResource', 'JobManagerResource', 'StatisticsResource',
 * 'VertexResourceInUserFolder', 'JobManagerResourceInUserFolder',
 * 'StatisticsResourceInUserFolder'
 * 
 */
export interface JobResource {
    name?: string;
    resourcePath?: string;
    type?: string;
}

/**
 * @class
 * Initializes a new instance of the JobProperties class.
 * @constructor
 * The common Data Lake Analytics job properties.
 *
 * @member {string} [runtimeVersion] the runtime version of the Data Lake
 * Analytics engine to use for the specific type of job being run.
 * 
 * @member {string} script the script to run
 * 
 * @member {string} type Polymorhpic Discriminator
 * 
 */
export interface JobProperties {
    runtimeVersion?: string;
    script: string;
    type: string;
}

/**
 * @class
 * Initializes a new instance of the USqlJobProperties class.
 * @constructor
 * @member {array} [resources] the list of resources that are required by the
 * job
 * 
 * @member {object} [statistics] the job specific statistics.
 * 
 * @member {date} [statistics.lastUpdateTimeUtc] the last update time for the
 * statistics.
 * 
 * @member {array} [statistics.stages] the list of stages for the job.
 * 
 * @member {object} [debugData] the job specific debug data locations.
 * 
 * @member {uuid} [debugData.jobId] the id of the job this data is for.
 * 
 * @member {string} [debugData.command] the command that this job data relates
 * to.
 * 
 * @member {array} [debugData.paths] the list of paths to all of the job data.
 * 
 * @member {array} [diagnostics] the diagnostics for the job.
 * 
 * @member {string} [algebraFilePath] the algebra file path after the job has
 * completed
 * 
 * @member {moment.duration} [totalCompilationTime] the total time this job
 * spent compiling. This value should not be set by the user and will be
 * ignored if it is.
 * 
 * @member {moment.duration} [totalPauseTime] the total time this job spent
 * paused. This value should not be set by the user and will be ignored if it
 * is.
 * 
 * @member {moment.duration} [totalQueuedTime] the total time this job spent
 * queued. This value should not be set by the user and will be ignored if it
 * is.
 * 
 * @member {moment.duration} [totalRunningTime] the total time this job spent
 * executing. This value should not be set by the user and will be ignored if
 * it is.
 * 
 * @member {string} [rootProcessNodeId] the ID used to identify the job
 * manager coordinating job execution. This value should not be set by the
 * user and will be ignored if it is.
 * 
 * @member {string} [yarnApplicationId] the ID used to identify the yarn
 * application executing the job. This value should not be set by the user
 * and will be ignored if it is.
 * 
 * @member {number} [yarnApplicationTimeStamp] the timestamp (in ticks) for
 * the yarn application executing the job. This value should not be set by
 * the user and will be ignored if it is.
 * 
 * @member {string} [compileMode] the compile mode for the job. Possible
 * values include: 'Semantic', 'Full', 'SingleBox'
 * 
 */
export interface USqlJobProperties extends JobProperties {
    resources?: JobResource[];
    statistics?: JobStatistics;
    debugData?: JobDataPath;
    diagnostics?: Diagnostics[];
    algebraFilePath?: string;
    totalCompilationTime?: moment.Duration;
    totalPauseTime?: moment.Duration;
    totalQueuedTime?: moment.Duration;
    totalRunningTime?: moment.Duration;
    rootProcessNodeId?: string;
    yarnApplicationId?: string;
    yarnApplicationTimeStamp?: number;
    compileMode?: string;
}

/**
 * @class
 * Initializes a new instance of the Diagnostics class.
 * @constructor
 * @member {number} [columnNumber] the column where the error occured.
 * 
 * @member {number} [end] the ending index of the error.
 * 
 * @member {number} [lineNumber] the line number the error occured on.
 * 
 * @member {string} [message] the error message.
 * 
 * @member {string} [severity] the severity of the error. Possible values
 * include: 'Warning', 'Error', 'Info'
 * 
 * @member {number} [start] the starting index of the error.
 * 
 */
export interface Diagnostics {
    columnNumber?: number;
    end?: number;
    lineNumber?: number;
    message?: string;
    severity?: string;
    start?: number;
}

/**
 * @class
 * Initializes a new instance of the HiveJobStatementInfo class.
 * @constructor
 * @member {string} [logLocation] the log location for this statement.
 * 
 * @member {string} [resultPreviewLocation] the result preview location for
 * this statement.
 * 
 * @member {string} [resultLocation] the result location for this statement.
 * 
 * @member {string} [errorMessage] the error message for this statement.
 * 
 */
export interface HiveJobStatementInfo {
    logLocation?: string;
    resultPreviewLocation?: string;
    resultLocation?: string;
    errorMessage?: string;
}

/**
 * @class
 * Initializes a new instance of the HiveJobProperties class.
 * @constructor
 * @member {array} [statementInfo] the statement information for each
 * statement in the script
 * 
 * @member {string} [logsLocation] the Hive logs location
 * 
 * @member {string} [warehouseLocation] the location of the Hive warehouse
 * 
 * @member {number} [statementCount] the number of statements that will be run
 * based on the script
 * 
 * @member {number} [executedStatementCount] the number of statements that
 * have been run based on the script
 * 
 */
export interface HiveJobProperties extends JobProperties {
    statementInfo?: HiveJobStatementInfo[];
    logsLocation?: string;
    warehouseLocation?: string;
    statementCount?: number;
    executedStatementCount?: number;
}

/**
 * @class
 * Initializes a new instance of the JobErrorDetails class.
 * @constructor
 * The Data Lake Analytics job error details.
 *
 * @member {string} [description] the error message description
 * 
 * @member {string} [details] the details of the error message.
 * 
 * @member {number} [endOffset] the end offset in the job where the error was
 * found.
 * 
 * @member {string} [errorId] the specific identifier for the type of error
 * encountered in the job.
 * 
 * @member {string} [filePath] the path to any supplemental error files, if
 * any.
 * 
 * @member {string} [helpLink] the link to MSDN or Azure help for this type of
 * error, if any.
 * 
 * @member {string} [internalDiagnostics] the internal diagnostic stack trace
 * if the user requesting the job error details has sufficient permissions it
 * will be retrieved, otherwise it will be empty.
 * 
 * @member {number} [lineNumber] the specific line number in the job where the
 * error occured.
 * 
 * @member {string} [message] the user friendly error message for the failure.
 * 
 * @member {string} [resolution] the recommended resolution for the failure,
 * if any.
 * 
 * @member {object} [innerError] the inner error of this specific job error
 * message, if any.
 * 
 * @member {number} [innerError.diagnosticCode] the diagnostic error code.
 * 
 * @member {string} [innerError.severity] the severity level of the failure.
 * Possible values include: 'Warning', 'Error', 'Info'
 * 
 * @member {string} [innerError.details] the details of the error message.
 * 
 * @member {string} [innerError.component] the component that failed.
 * 
 * @member {string} [innerError.errorId] the specific identifier for the type
 * of error encountered in the job.
 * 
 * @member {string} [innerError.helpLink] the link to MSDN or Azure help for
 * this type of error, if any.
 * 
 * @member {string} [innerError.internalDiagnostics] the internal diagnostic
 * stack trace if the user requesting the job error details has sufficient
 * permissions it will be retrieved, otherwise it will be empty.
 * 
 * @member {string} [innerError.message] the user friendly error message for
 * the failure.
 * 
 * @member {string} [innerError.resolution] the recommended resolution for the
 * failure, if any.
 * 
 * @member {string} [innerError.source] the ultimate source of the failure
 * (usually either SYSTEM or USER).
 * 
 * @member {string} [innerError.description] the error message description
 * 
 * @member {string} [severity] the severity level of the failure. Possible
 * values include: 'Warning', 'Error', 'Info'
 * 
 * @member {string} [source] the ultimate source of the failure (usually
 * either SYSTEM or USER).
 * 
 * @member {number} [startOffset] the start offset in the job where the error
 * was found
 * 
 */
export interface JobErrorDetails {
    description?: string;
    details?: string;
    endOffset?: number;
    errorId?: string;
    filePath?: string;
    helpLink?: string;
    internalDiagnostics?: string;
    lineNumber?: number;
    message?: string;
    resolution?: string;
    innerError?: JobInnerError;
    severity?: string;
    source?: string;
    startOffset?: number;
}

/**
 * @class
 * Initializes a new instance of the JobInnerError class.
 * @constructor
 * The Data Lake Analytics job error details.
 *
 * @member {number} [diagnosticCode] the diagnostic error code.
 * 
 * @member {string} [severity] the severity level of the failure. Possible
 * values include: 'Warning', 'Error', 'Info'
 * 
 * @member {string} [details] the details of the error message.
 * 
 * @member {string} [component] the component that failed.
 * 
 * @member {string} [errorId] the specific identifier for the type of error
 * encountered in the job.
 * 
 * @member {string} [helpLink] the link to MSDN or Azure help for this type of
 * error, if any.
 * 
 * @member {string} [internalDiagnostics] the internal diagnostic stack trace
 * if the user requesting the job error details has sufficient permissions it
 * will be retrieved, otherwise it will be empty.
 * 
 * @member {string} [message] the user friendly error message for the failure.
 * 
 * @member {string} [resolution] the recommended resolution for the failure,
 * if any.
 * 
 * @member {string} [source] the ultimate source of the failure (usually
 * either SYSTEM or USER).
 * 
 * @member {string} [description] the error message description
 * 
 */
export interface JobInnerError {
    diagnosticCode?: number;
    severity?: string;
    details?: string;
    component?: string;
    errorId?: string;
    helpLink?: string;
    internalDiagnostics?: string;
    message?: string;
    resolution?: string;
    source?: string;
    description?: string;
}

/**
 * @class
 * Initializes a new instance of the JobInformation class.
 * @constructor
 * The common Data Lake Analytics job information properties.
 *
 * @member {uuid} [jobId] the job's unique identifier (a GUID).
 * 
 * @member {string} name the friendly name of the job.
 * 
 * @member {string} type the job type of the current job (Hive or USql).
 * Possible values include: 'USql', 'Hive'
 * 
 * @member {string} [submitter] the user or account that submitted the job.
 * 
 * @member {array} [errorMessage] the error message details for the job, if
 * the job failed.
 * 
 * @member {number} [degreeOfParallelism] the degree of parallelism used for
 * this job. This must be greater than 0.
 * 
 * @member {number} [priority] the priority value for the current job. Lower
 * numbers have a higher priority. By default, a job has a priority of 1000.
 * This must be greater than 0.
 * 
 * @member {date} [submitTime] the time the job was submitted to the service.
 * 
 * @member {date} [startTime] the start time of the job.
 * 
 * @member {date} [endTime] the completion time of the job.
 * 
 * @member {string} [state] the job state. When the job is in the Ended state,
 * refer to Result and ErrorMessage for details. Possible values include:
 * 'Accepted', 'Compiling', 'Ended', 'New', 'Queued', 'Running',
 * 'Scheduling', 'Starting', 'Paused', 'WaitingForCapacity'
 * 
 * @member {string} [result] the result of job execution or the current result
 * of the running job. Possible values include: 'None', 'Succeeded',
 * 'Cancelled', 'Failed'
 * 
 * @member {string} [logFolder] the log folder path to use in the following
 * format:
 * adl://<accountName>.azuredatalakestore.net/system/jobservice/jobs/Usql/2016/03/13/17/18/5fe51957-93bc-4de0-8ddc-c5a4753b068b/logs/.
 * 
 * @member {array} [logFilePatterns] the list of log file name patterns to
 * find in the logFolder. '*' is the only matching character allowed. Example
 * format: jobExecution*.log or *mylog*.txt
 * 
 * @member {array} [stateAuditRecords] the job state audit records, indicating
 * when various operations have been performed on this job.
 * 
 * @member {object} properties the job specific properties.
 * 
 * @member {string} [properties.runtimeVersion] the runtime version of the
 * Data Lake Analytics engine to use for the specific type of job being run.
 * 
 * @member {string} [properties.script] the script to run
 * 
 * @member {string} [properties.type] Polymorhpic Discriminator
 * 
 */
export interface JobInformation {
    jobId?: string;
    name: string;
    type: string;
    submitter?: string;
    errorMessage?: JobErrorDetails[];
    degreeOfParallelism?: number;
    priority?: number;
    submitTime?: Date;
    startTime?: Date;
    endTime?: Date;
    state?: string;
    result?: string;
    logFolder?: string;
    logFilePatterns?: string[];
    stateAuditRecords?: JobStateAuditRecord[];
    properties: JobProperties;
}
