# -*- coding: utf-8 -*-
# Copyright (c) 2020, JINGROW
# For license information, please see license.txt


import jingrow
from jingrow.model.page import Page


class AnsibleTask(Page):
	# begin: auto-generated types
	# This code is auto-generated. Do not modify anything in this block.

	from typing import TYPE_CHECKING

	if TYPE_CHECKING:
		from jingrow.types import DF

		duration: DF.Time | None
		end: DF.Datetime | None
		error: DF.Code | None
		exception: DF.Code | None
		job_id: DF.Data | None
		output: DF.Code | None
		play: DF.Link
		result: DF.Code | None
		role: DF.Data
		start: DF.Datetime | None
		status: DF.Literal[
			"Pending", "Running", "Success", "Failure", "Skipped", "Unreachable"
		]
		task: DF.Data
	# end: auto-generated types

	def on_update(self):
		jingrow.publish_realtime(
			"ansible_play_update",
			pagetype="Ansible Play",
			docname=self.play,
			message={"id": self.play},
		)
