from pmb_py.domain import model


def to_project_status(item):
    return model.ProjectStatus(item['id'], item['name'], item['colorCode'], item['code'], item['colorText'])


def to_project_type(item):
    return model.ProjectType(item['id'], item['name'])


def to_member_status(item):
    return model.MemberStatus(item['id'], item['name'], item['codeName'])


def to_project(item):
    return model.Project(**item)


# def to_pmb_task(item):
#     return model.


def to_pmb_block(item):
    return model.Block(item['id'], item['date'], item['duration'], item['task_id'], item['member_id'], item['project_id'], item['type_id'])


def to_pmb_gantt_item(item):
    return model.GanttItem(id=item['id'], name=item['name'], start_datetime=item['start_datetime'], end_datetime=item['end_datetime'],
                           task_type=item['task_type'], parent_id=item['parent_id'], sg_task_id=item['sg_task_id'], legend=item['legend'],
                           read_only=item['read_only'], status=item['status'], project_id=item['project_id']
                           )
