selfprivacy.org.app/lib/logic/models/job.dart

55 lines
1.3 KiB
Dart
Raw Normal View History

2021-05-25 21:53:54 +00:00
import 'package:equatable/equatable.dart';
2021-06-08 18:52:44 +00:00
import 'package:flutter/material.dart';
2021-08-18 10:44:46 +00:00
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
2021-08-18 09:36:40 +00:00
import 'package:selfprivacy/utils/password_generator.dart';
2021-08-18 10:44:46 +00:00
import 'package:easy_localization/easy_localization.dart';
2021-05-25 21:53:54 +00:00
2021-08-29 15:02:51 +00:00
import 'user.dart';
2021-06-08 18:52:44 +00:00
@immutable
2021-05-25 21:53:54 +00:00
class Job extends Equatable {
Job({
String? id,
required this.title,
2021-08-18 09:36:40 +00:00
}) : id = id ?? StringGenerators.simpleId();
2021-05-25 21:53:54 +00:00
final String title;
final String id;
@override
List<Object> get props => [id, title];
}
2021-06-08 18:52:44 +00:00
class CreateUserJob extends Job {
CreateUserJob({
required this.user,
2021-08-18 10:44:46 +00:00
}) : super(title: '${"jobs.createUser".tr()} ${user.login}');
2021-06-08 18:52:44 +00:00
final User user;
@override
2021-08-29 15:02:51 +00:00
List<Object> get props => [id, title, user];
2021-06-08 18:52:44 +00:00
}
2021-08-18 10:44:46 +00:00
class ServiceToggleJob extends Job {
ServiceToggleJob({
required this.type,
required this.needToTurnOn,
2021-08-29 15:02:51 +00:00
}) : super(
title:
'${needToTurnOn ? "jobs.serviceTurnOn".tr() : "jobs.serviceTurnOff".tr()} ${type.title}');
2021-08-18 10:44:46 +00:00
final ServiceTypes type;
final bool needToTurnOn;
@override
2021-08-29 15:02:51 +00:00
List<Object> get props => [id, title, type, needToTurnOn];
2021-08-18 10:44:46 +00:00
}
2021-09-02 19:32:07 +00:00
class CreateSSHKeyJob extends Job {
CreateSSHKeyJob() : super(title: '${"more.create_ssh_key".tr()}');
@override
List<Object> get props => [id, title];
}